我有一个docker logstash配置如下:
input {
tcp {
port => 5000
}
}
output {
elasticsearch {
hosts => ["https://my-custom-elastic.com:9321"]
字符串
预期:
我希望logstash连接到https://my-custom-elastic.com:9321,而不是http://elasticsearch:9200/
实际:
在100%的情况下,我得到了这个错误:
[2023-08-18T06:11:35,099][INFO ][logstash.licensechecker.licensereader] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://elasticsearch:9200/]}}
[2023-08-18T06:11:35,409][INFO ][logstash.licensechecker.licensereader] Failed to perform request {:message=>"elasticsearch: Name or service not known", :exception=>Manticore::ResolutionFailure, :cause=>java.net.UnknownHostException: elasticsearch: Name or service not known}
[2023-08-18T06:11:35,415][WARN ][logstash.licensechecker.licensereader] Attempted to resurrect connection to dead ES instance, but got an error {:url=>"http://elasticsearch:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :message=>"Elasticsearch Unreachable: [http://elasticsearch:9200/][Manticore::ResolutionFailure] elasticsearch: Name or service not known"}
[2023-08-18T06:11:35,599][INFO ][logstash.licensechecker.licensereader] Failed to perform request {:message=>"elasticsearch", :exception=>Manticore::ResolutionFailure, :cause=>java.net.UnknownHostException: elasticsearch}
型
我确信logstash正在获取正确的配置,因为在这个错误之后,几行之后,它确实连接到了我预期的目的地。
问:
为什么即使我配置了自定义主机,logstash仍然试图连接到localhost?
1条答案
按热度按时间ippsafx71#
我遇到了同样的问题,并发现了几篇文章,建议它来自logstash x-pack监控,默认情况下是打开的,请参阅这里:https://discuss.elastic.co/t/logstash-outputs-elasticsearch-is-trying-to-connect-to-another-elasticsearch/101526/5
对我有效的解决方案是进入:
字符串
在
logstash.yml
中(在我的容器中,它在/usr/share/logstash/config/logstash.yml
下)。