Elasticsearch and logstash inside docker - connection refused

Hello, I have a logstash image on a docker container, and elasticsearch on a different host (xx.xx.xx.xx). My config files look like this:

  • docker-compose.yml

      version: '3.7'
            image: logstash:1.0
               - "5044:5044"
            command: logstash -f /config-dir/logstash.conf
               - "/docker/logstash:/config-dir:ro"
               - XPACK_MONITORING_ENABLED=false
  • logstash.conf

      input {
        beats {
          port => 5044
      output {
        elasticsearch {
          hosts => ["xx.xx.xx.xx:9200"]

On elasticsearch.yml, everything is commented out.

I'm getting the following error on Logstash:

[2019-09-30T23:13:30,269][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://xx.xx.xx.xx:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://xx.xx.xx.xx:9200/][Manticore::SocketException] Connection refused (Connection refused)"}

Not sure what the problem is. Do I need to add network.host on elasticsearch.yml, or if this setup is enough? Also, not sure if port binding is needed since logstash is in docker?

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