logstash-plugins / logstash-input-snmptrap

Apache License 2.0
12 stars 20 forks source link

Error while parsing the hexadecimal data obtained via SNMP #7

Open jordansissel opened 9 years ago

jordansissel commented 9 years ago

(This issue was originally filed by @janotherson at https://github.com/elastic/logstash/issues/1962)


Logstash crashes when trying to parse the hexadecimal data obtained via SNMP. Logstash version: 1.4.2.

SNMP input config: input { snmptrap { community => "public" host => "0.0.0.0" port => 162 type => "snmp" } }

Debug output: output received {:event=>{"message"=>"#<SNMP::SNMPv2_Trap:0x436444e5 @error_index=0, @varbind_list=[#<SNMP::VarBind:0x194c10dd @value=#<SNMP::TimeTicks:0x50e72a24 @value=288384705>, @name=[1.3.6.1.2.1.1.3.0]>, #<SNMP::VarBind:0x787fcafa @value=[1.3.6.1.4.1.171.11.105.3.2.100.1.2.0.1], @name=[1.3.6.1.6.3.1.1.4.1.0]>, #<SNMP::VarBind:0x41205fdd @value=\"\x01\xB8\x03\x05\xA5Np\x01\x001\x00\", @name=[1.3.6.1.4.1.171.11.105.3.2.100.1.2.1.1]>], @error_status=0, @request_id=27864, @source_ip=\"10.90.90.140\">", "host"=>"10.90.90.140", "@version"=>"1", "@timestamp"=>"2014-10-27T12:35:05.798Z", "type"=>"snmp", "SNMPv2-MIB::sysUpTime.0"=>"33 days, 09:04:07.05", "SNMPv2-MIB::snmpTrapOID.0"=>"SNMPv2-SMI::enterprises.171.11.105.3.2.100.1.2.0.1", "SNMPv2-SMI::enterprises.171.11.105.3.2.100.1.2.1.1"=>"\x01\xB8\x03\x05\xA5Np\x01\x001\x00"}, :level=>:debug, :file=>"(eval)", :line=>"49"}

Error: Encoding::UndefinedConversionError: ""\xB8"" from ASCII-8BIT to UTF-8 encode at org/jruby/RubyString.java:7575 to_json at json/ext/GeneratorMethods.java:71 to_json at /opt/logstash/lib/logstash/event.rb:148 receive at /opt/logstash/lib/logstash/outputs/file.rb:71 handle at /opt/logstash/lib/logstash/outputs/base.rb:86 initialize at (eval):50 call at org/jruby/RubyProc.java:271 output at /opt/logstash/lib/logstash/pipeline.rb:266 outputworker at /opt/logstash/lib/logstash/pipeline.rb:225 start_outputs at /opt/logstash/lib/logstash/pipeline.rb:152

zjcnew commented 6 years ago

How can I solve?