[UPDATED] Logstash output to elasticsearch in docker

(Jaxon Kochel) #1

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

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=>, :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:>, :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [][Manticore::SocketException] Connection refused (Connection refused)"}

Seems like it cannot connect to elasticsearch.

In the output section of my confige file ive tried:

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

Nothing seems to work. Am I doing somehting wrong?

(Jaxon Kochel) #2

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

(system) #3

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