elastic / logstash

Logstash - transport and process your logs, events, or other data
https://www.elastic.co/products/logstash
Other
14.22k stars 3.5k forks source link

[logstash.outputs.nagiosnsca] TypeError: no implicit conversion of Fixnum into String #8886

Open maraev opened 6 years ago

maraev commented 6 years ago

Hello, I posted it to discuss but noone answered me. I have logstash 6.1.0 +jdk1.8.0_151 + logstash-outputs-nagios_nsca(3.0.5) plugin installed. OS; RHEL 7.2 My config is: ` input { file { path => "/opt/mylog.log" start_position => "beginning" } }

filter { grok { match => { "message" => " ERROR " } add_field => { "found" => "yes" } } }

output { if [found] { nagios_nsca { id => "010101" codec => "plain" host => "nagios.server.com" port => 5667 send_nsca_bin => "/opt/nsca/send_nsca" send_nsca_config => "/opt/nsca/send_nsca.cfg" message_format => "%{@timestamp} %{host}: Error message found: %{message}" nagios_host => "myhost.server.com" nagios_service => "ncsa_log_service" nagios_status => "2" } } }`

So, I start single logstash for testing as /opt/logstash/bin/logstash -f /opt/logstash_nsca.conf When I change my logfile for testing, like to add a new string with ERROR pattern, logstash responds and throws the following exception [2017-12-22T19:04:45,972][WARN ][logstash.outputs.nagiosnsca] Skipping nagios_nsca output; error calling send_nsca {:error=>#<TypeError: no implicit conversion of Fixnum into String>, :nagios_nsca_command=>"/opt/nsca/send_nsca -H nagios.server.com -p 5667 -d : -c /opt/nsca/send_nsca.cfg", :message=>"myhost.server.com:ncsa_log_service:2:2017-12-22T15:04:45.603Z rhel7: Error message found: 2017-12-22 19:04:05 ERROR SftpOperations - JSCH -> SSH_MSG_SERVICE_ACCEPT received", :missed_event=>#LogStash::Event:0x118315a2} Off course nothing sends anywhere. But if I test it manually like the follow command _echo "server\tservice\tstatus\tmessage" | /opt/nsca/send_nsca -H nagios.server.com -d : -p 5667 -c /opt/nsca/sendnsca.cfg it works and I see it in syslog of the nagios server Can someone help me in this case?

maraev commented 6 years ago

I've tested it with logstash v5.6.3 and it seems to work well