Hi
I have a json file , for which i am not able to navigate to the events with logstash 5.0.
I want to extract the name of cars from below
using get and set method of ruby as per the documentation
event.get('[message][cars[name]')
{
"name":"John",
"age":30,
"cars": [
{ "name":"Ford", "models":[ "Fiesta", "Focus", "Mustang" ] },
{ "name":"BMW", "models":[ "320", "X3", "X5" ] },
{ "name":"Fiat", "models":[ "500", "Panda" ] }
]
}
Here is my conf file
input {
file {
sincedb_path => "..../bin/sincedb_path.txt"
path => "..../test1.json"
type => "test"
start_position => "beginning"
}
}
filter {
ruby {
code => "
test = event.get('[message][cars][name]')
event.set('result',test)
"
}
}
output {
stdout { codec => rubydebug}
}
With the above config file i get nil value.
Please let me know correct way to navigate to the path