# Dynamic Elasticsearch Host for Logstash on Docker

**URL:** https://discuss.elastic.co/t/dynamic-elasticsearch-host-for-logstash-on-docker/182727
**Category:** Logstash
**Tags:** docker
**Created:** [May 24, 2019, 9:10pm UTC](https://discuss.elastic.co/t/dynamic-elasticsearch-host-for-logstash-on-docker/182727 "2019-05-24T21:10:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jamiejackson](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@jamiejackson](https://discuss.elastic.co/u/jamiejackson)
#### Post date: [May 24, 2019, 9:10pm UTC](https://discuss.elastic.co/t/dynamic-elasticsearch-host-for-logstash-on-docker/182727/1 "2019-05-24T21:10:08Z")

</div>

How do I set the Elasticsearch host without hardcoding it in `pipeline.conf`?

I think [https://www.elastic.co/guide/en/logstash/current/docker-config.html#docker-env-config](https://www.elastic.co/guide/en/logstash/current/docker-config.html#docker-env-config) is trying to tell me how, but I can't put the pieces together.

I've tried a bunch of things; nothing but hardcoding seems to work.

Here were my failed attempts at setting via environment variables:

```auto
    environment:
# xpack.monitoring.elasticsearch.hosts: http://elasticsearch-monitoring:9200
# OUTPUT_ELASTICSEARCH_HOSTS: http://elasticsearch-monitoring:9200
# outputs.elasticsearch.url: http://elasticsearch-monitoring:9200
# OUTPUT_ELASTICSEARCH_URL: http://elasticsearch-monitoring:9200
# logstash.outputs.elasticsearch.url: http://elasticsearch-monitoring:9200
# logstash.outputs.elasticsearch.hosts: http://elasticsearch-monitoring:9200
# OUTPUT_ELASTICSEARCH_HOSTS: http://elasticsearch-monitoring:9200
# output.elasticsearch.hosts: http://elasticsearch-monitoring:9200
# xpack.monitoring.elasticsearch.url: http://elasticsearch-monitoring:9200

```

What's the right way to do this?

Thanks,  
Jamie

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 21, 2019, 9:10pm UTC](https://discuss.elastic.co/t/dynamic-elasticsearch-host-for-logstash-on-docker/182727/2 "2019-06-21T21:10:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
