I'm using a docker-compose to start my whole stack and I have a problem with my logstash. I have two errors on my logstash logs.
elasticsearch - Failed to perform request {:message=>"Connect to localhost:9200 [localhost/127.0.0.1] failed: Connection refused", :exception=>Manticore::SocketException, :cause=>#<Java::OrgApacheHttpConn::HttpHostConnectException: Connect to localhost:9200 [localhost/127.0.0.1] failed: Connection refused>}
elasticsearch - Attempted to resurrect connection to dead ES instance, but got an error {:url=>"https://localhost:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :message=>"Elasticsearch Unreachable: [https://localhost:9200/][Manticore::SocketException] Connect to localhost:9200 [localhost/127.0.0.1] failed: Connection refused"}
It seems to come from the same thing but I don't know what to do.
Where is your logstash running? On a container or in your host machine? If it is running on a container, it is running in the same container as Elasticsearch?
When you use localhost on the elasticsearch output it means that the elasticsearch service is on the same server/container as Logstash.
[WARN ] 2023-04-25 15:05:41.064 [Ruby-0-Thread-9: /usr/share/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-output-elasticsearch-11.13.1-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:213] elasticsearch - Attempted to resurrect connection to dead ES instance, but got an error {:url=>"https://es01:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :message=>"Elasticsearch Unreachable: [https://es01:9200/][Manticore::SocketException] Connect to es01:9200 [es01/172.21.0.4] failed: Connection refused"}
[WARN ] 2023-04-25 15:05:41.345 [Ruby-0-Thread-9: /usr/share/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-output-elasticsearch-11.13.1-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:213] elasticsearch - Attempted to resurrect connection to dead ES instance, but got an error {:url=>"https://es02:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '401' contacting Elasticsearch at URL 'https://es02:9200/'"}
[WARN ] 2023-04-25 15:05:41.507 [Ruby-0-Thread-9: /usr/share/logstash/vendor/bundle/jruby/2.6.0/gems/logstash-output-elasticsearch-11.13.1-java/lib/logstash/outputs/elasticsearch/http_client/pool.rb:213] elasticsearch - Attempted to resurrect connection to dead ES instance, but got an error {:url=>"https://es03:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '401' contacting Elasticsearch at URL 'https://es03:9200/'"}
Do I need to configure some user/password somewhere ?
Since you are using the api_key parameter, you do not net an user/password, but you need to check if you provided the correct information about the api key.
It seems that the configuration is wrong, the documentation says this:
Format is id:api_key where id and api_key are as returned by the Elasticsearch Create API key API.
You do not have this format in your configuration, something is missing.
Ok thank you. I added the id in the output and the last errors disappear but now I only have one left for each node.
elasticsearch - Attempted to resurrect connection to dead ES instance, but got an error {:url=>"https://es02:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :message=>"Got response code '401' contacting Elasticsearch at URL 'https://es02:9200/'"}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.