Hello,
I have an issue finding a solution for my problem :
My filebeat sends IIS logs to logstash, with an URIPATH field named iis.uri, it looks like :
/aaaaa/bbbbb/cccccc/dddddd/eeeeee
I copy this field i wanna keep into a new field named iis.uriSplit in a mutate-copy then i use mutate-split to get an array from this field, so i got :
iis.uri : /aaaaa/bbbbb/cccccc/dddddd/eeeeee
iis.uriSplit : (empty field here) , aaaaa , bbbbb , cccccc , dddddd , eeeeee
And now i woud like to get iis.uriSplit.1 = aaaaa
, iis.uriSplit.2 = bbbbb
etc.. to use them as alone fields for term aggregation in visualisations, and that's where is my problem.
I tried to use ruby filter to do so :
ruby {
code => '
urisplit = event.get("[iis][uriSplit]")
urisplit.each_with_index do |hash, index|
event.set("iis.uri.#{index}", hash)
end
'
}
OR
code => '
event.get("[iis][uriSplit]").each_with_index do |hash, index|
event.set("[iis][uri][#{index}]", hash)
end
'
But it tells me i have an ERROR at ' event.get(" '
Do you have a better knowledge about ruby and could you share it with me ?
Thanks for your time,
Best regards,
Louis Vince.