No, you are missing my point. I was trying to show that if the event has a field id which contains "12" then that translate filter will set [location] to "garden".
If the filter is not doing that it suggests the event does not have an [id] field.
The filter you had in your initial post is the right way to do it. If it does not do the translation the only explanation I can think of is that the event does not have an [id] field.
The field id is an array object :
In my grok filter :
u'ids': \[(?<[@metadata][ids]>[^\]]+)\]
In my ruby filter :
ids = event.get('[@metadata][ids]')
if ids
id = ids.scan(/{u'type': u'([^']+)', u'id': ([0-9]+)}/)
event.set('id', id)
end
So in Kibana, it's visible like this :
["firstid", "1"]
["secondid", "2"]
Logstash don't like this and loop restart. I'm unable to select which field I want in id.
Edit : I try with another field which is not nested ( %{GREEDYDATA:dst-ip} ) , but it doesn't work
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.