I tested in the debugger and seems everything is fine
but when I run sudo /usr/share/logstash/bin/logstash -f test-s.conf
Cannot filter with _grokparsefailure
{
"@timestamp" => 2019-07-15T12:31:19.301Z,
"host" => "10.0.10.108",
"tags" => [
[0] "_grokparsefailure"
],
"@version" => "1",
"iso.org.dod.internet.private.enterprises.2440.1.11.2.4.8.0" => 0
}
Interesting, normally people want to do the opposite of that. You can do it using a ruby filter. If there will ever be more than one piece of data you could use
ruby {
code => '
a = []
event.to_hash.each { |k, v|
if k.start_with?("iso.org.dod.internet") then
h = Hash.new
h["oid"] = k
h["snmpdata"] = v
a << h
event.remove(k)
end
}
event.set("someField", a)
'
}
If you know there will only be one then take the array out of it and use the hash in event.set
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.