# \[UPDATED\] Logstash output to elasticsearch in docker

**URL:** <https://discuss.elastic.co/t/updated-logstash-output-to-elasticsearch-in-docker/87789>\
**Category:** Logstash\
**Created:** [May 31, 2017, 5:26pm UTC](https://discuss.elastic.co/t/updated-logstash-output-to-elasticsearch-in-docker/87789 "2017-05-31T17:26:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaxon\_Kochel](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@Jaxon\_Kochel](https://discuss.elastic.co/u/Jaxon_Kochel)\
**Post date:** [May 31, 2017, 5:26pm UTC](https://discuss.elastic.co/t/updated-logstash-output-to-elasticsearch-in-docker/87789/1 "2017-05-31T17:26:03Z")

</div>

I'm currently experiencing an issue getting my logstash output to get to elasticsearch inside docker containers

I start elasticsearch like this:

docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 [docker.elastic.co](http://docker.elastic.co)  
/elasticsearch/elasticsearch:5.3.0

and logstash like this:

docker run --name logstash --rm -it -p 5044:5044 --link elasticsearch:elastics  
earch -v /c/Users/e-team/Documents/ELK/logs:/tmp/ -v /c/Users/e-team/Documents/elk\_docker/:/etc/logstash/conf.d/ logstas  
h -f /etc/logstash/conf.d/logstash.conf

In my logstash start command i am linking it to the elasticsearch container.

When the conf file runs it giving me the following error:

```
15:24:28.741 [Api Webserver] INFO logstash.agent - Successfully started Logstash API endpoint {:port=>9600}
15:24:33.595 [Ruby-0-Thread-12: /usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-6.3.0-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:234] INFO logstash.outputs.elasticsearch - Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://127.0.0.1:9200/, :path=>"/"}
15:24:33.601 [Ruby-0-Thread-12: /usr/share/logstash/vendor/bundle/jruby/1.9/gems/logstash-output-elasticsearch-6.3.0-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:234] WARN logstash.outputs.elasticsearch - Attempted to resurrect connection to dead ES instance, but got an error. {:url=>#<URI::HTTP:0x2464c5ba URL:http://127.0.0.1:9200/>, :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://127.0.0.1:9200/][Manticore::SocketException] Connection refused (Connection refused)"}

```

Seems like it cannot connect to elasticsearch.

In the output section of my confige file ive tried:

hosts =\> ["127.0.0.1"]  
hosts =\> ["localhost"]  
hosts =\> ["localhost:9200"]  
hosts =\> ["elasticsearch"]

Nothing seems to work. Am I doing somehting wrong?

---

<div class="post-metadata">

**Author:** ![Jaxon\_Kochel](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@Jaxon\_Kochel](https://discuss.elastic.co/u/Jaxon_Kochel)\
**Post date:** [June 2, 2017, 2:32pm UTC](https://discuss.elastic.co/t/updated-logstash-output-to-elasticsearch-in-docker/87789/2 "2017-06-02T14:32:46Z")

</div>

I managed to solve my issue after a few days of stupidity. Had to use my host machines IP address to port 9200

---

<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 30, 2017, 2:32pm UTC](https://discuss.elastic.co/t/updated-logstash-output-to-elasticsearch-in-docker/87789/3 "2017-06-30T14:32:48Z")

</div>

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