Hello,
I'm pretty new to logstash, and I need to replace a value in an array, using a kv filter's value,
but when I want to use the index variable nothing happens, if I use a simple integer instead, it works fine, here is my code I'm using:
"template" => [
[0] "Ön lekérdezte ",
[1] "id",
[2] " azonosítójú kártyája adatait"
],
ruby {code => "
event.get('template').each_with_index do |item,index|
hash = event.get('kv')
hash.each { |key,value|
if key.include? 'id'
event.set('[template][#{index}]', value)
end
}
end
"}
Any ideas what I'm doing wrong?
Thank you