Error [Manticore::ResolutionFailure] elasticsearch: Name or service not known"} at docker-compose

Hello to everyone!
Can anyone help with this?

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

Docker-compose.yml looks like this

elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
    restart: unless-stopped
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      - discovery.type=single-node
      - XPACK_SECURITY_ENABLED=false
      - XPACK_REPORTING_ENABLED=false
      - XPACK_MONITORING_ENABLED=false
#      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    depends_on:
      - logstash


  kibana:
    image: docker.elastic.co/kibana/kibana:7.0.1
    ports:
      - "5601:5601"
    depends_on:
      - elasticsearch
    restart: unless-stopped

  logstash:
    image: docker.elastic.co/logstash/logstash:7.0.1
    networks:
      - elk
    environment:
      - XPACK_SECURITY_ENABLED=false
      - XPACK_REPORTING_ENABLED=false
      - XPACK_MONITORING_ENABLED=false
      - ELASTIC_HOST=localhost:9200
    ports:
      - "5046:5046"
    volumes:
      - ./config/pipelines.yml:/usr/share/logstash/config/pipelines.yml:ro
      - ./config/pipelines:/usr/share/logstash/config/pipelines:ro

I have habr_pipeline.conf

input {
  tcp {
    port => "5046"
  }
}
filter {
  mutate {
    add_field => [ "habra_field", "Hello Habr" ]
  }
}
output {
  elasticsearch {
    hosts => "${ELASTIC_HOST}"
    user => ""
    password => ""
    index => "ts_indicator_description"
  }
}

When I change localhost to elasticsearch, I have nearly the same mistake

WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elasticsearch:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch"}

What I need to change?

I think you need to add the following to elasticsearch and kibana as well:

    networks:
      - elk

Thank you so much!

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