我使用logstash的http_poller输入来监控多个服务。它们中的每一个都为此目的公开了一个端点。
其中一个返回状态代码204(无内容),这会导致http_poller插件出现内部错误。
端点的其余部分返回状态代码200和“All Is OK”原始文本。他们工作正常。
错误是:
/opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-core-2.3.2-java/lib/logstash/util/charset.rb:14:in `convert', /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-codec-json-2.1.4/lib/logstash/codecs/json.rb:38:in `decode', /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-http_poller-2.0.6/lib/logstash/inputs/http_poller.rb:166:in `handle_success', /opt/logstash/vendor/bundle/jruby/1.9/gems/logstash-input-http_poller-2.0.6/lib/logstash/inputs/http_poller.rb:158:in `request_async', org/jruby/RubyProc.java:281:in `call', /opt/logstash/vendor/bundle/jruby/1.9/gems/manticore-0.5.5-java/lib/manticore/response.rb:250:in `handleResponse', Manticore$$Response_1062840788.gen:13:in `handleResponse', /opt/logstash/vendor/bundle/jruby/1.9/gems/manticore-0.5.5-java/lib/manticore/response.rb:50:in `call', Manticore$$Response_1062840788.gen:13:in `call'
我的配置如下:
input {
http_poller {
urls =>
{
myWebSite => "https://myWebsiteUrl:443/Monitor/Ping"
}
request_timeout => 30
# in seconds
interval => 30
tags => backend_healthcheck
metadata_target => http_poller_metadata
ssl_certificate_validation => false
}
}
filter {
if[http_poller_metadata]
{
mutate{
add_field =>{
"@target" => "%{http_poller_metadata[name]}"
}
}
}
}
output
{
elasticsearch { hosts => ["esServer:9200"]}
}