Hi,
I have been running an Elastic stack for over a year and was recently trying out X-Pack. When I added X-Pack, Logstash started trying to connect to ES on localhost even though my logstash instance is not configured to do that. If I uninstall x-pack, it stops doing that. If I reinstall, it does it again.
This wouldn't be a problem except that logstash appears to be ignoring the x-pack credentials for my actual cluster, preventing me from using ES with security. It only uses the 'elastic' user when trying to connect to localhost. (Aside - I know I should be using logstash_system, but I was just seeing if the authentication errors I was getting were due to privilege issues for the ES user). See below. Note that it attempts to connect to localhost using the elastic user, but to the 10.0.1 addresses, it doesn't try to authenticate.
[2018-05-22T11:52:42,854][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=
>["//10.0.1.40:9200", "//10.0.1.42:9200", "//10.0.1.43:9200"]}
[2018-05-22T15:03:43,014][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://10.0.1.40:9200/, :path=>"/"}
[2018-05-22T15:03:43,017][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://10.0.1.40:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :error=>"Got response code '401' contacting Elasticsearch at URL 'http://10.0.1.40:9200/'"}
[2018-05-22T15:03:43,017][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://10.0.1.42:9200/, :path=>"/"}
[2018-05-22T15:03:43,020][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://10.0.1.42:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :error=>"Got response code '401' contacting Elasticsearch at URL 'http://10.0.1.42:9200/'"}
[2018-05-22T15:03:43,020][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://10.0.1.43:9200/, :path=>"/"}
[2018-05-22T15:03:43,024][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://10.0.1.43:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :error=>"Got response code '401' contacting Elasticsearch at URL 'http://10.0.1.43:9200/'"}
[2018-05-22T15:03:44,261][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://elastic:xxxxxx@localhost:9200/, :path=>"/"}
[2018-05-22T15:03:44,261][INFO ][logstash.licensechecker.licensereader] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://elastic:xxxxxx@localhost:9200/, :path=>"/"}
[2018-05-22T15:03:44,267][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elastic:xxxxxx@localhost:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elastic:xxxxxx@localhost:9200/][Manticore::SocketException] Connection refused (Connection refused)"}
[2018-05-22T15:03:44,267][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elastic:xxxxxx@localhost:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elastic:xxxxxx@localhost:9200/][Manticore::SocketException] Connection refused (Connection refused)"
even though my logstash configuration specifies a cluster with IPs that do not include localhost.
output {
elasticsearch {
hosts => ["10.0.1.40:9200", "10.0.1.42:9200", "10.0.1.43:9200"]
index => "logger-%{+YYYY.MM.dd}"
template_overwrite => true
template_name => "logger"
manage_template => true
template => "/etc/logstash/templates/logger.json"
}
}