Hi,
This is my Ruby filter code in logstash:
message_array = event.get("message").split("\n\n[")
message_array.each do | index |
if index!=0
event.set("Rule#{index}", "[" + message_array[index])
end
end
I am getting the error on run:
[2018-02-08T19:01:18,716][ERROR][logstash.filters.ruby ] Ruby exception occurred: can't convert String into Integer
The problem is in the line: event.set("Rule#{index}", "[" + message_array[index])
If I do as below, it works fine:
event.set("Rule1", "[" + message_array[1])
event.set("Rule2", "[" + message_array[2])
Can you pls help me to understand where the conversion from string to integer happens?
Thanks
Sharon.