Ruby Filter change in 5


(Hans) #1

Hi, I have been using a Ruby filter for some of by information, however since I have upgraded to 5 these no longer work. I have tried to understand exactly what changes under https://www.elastic.co/guide/en/logstash/5.x/breaking-changes.html however without success. Could I kindly get assistance with the change of the filter to be compatible again with Logstash 5?

Here are my two filters I use:
ruby{ code=>"event['Duration_m'] = (event['Duration_s'] / 60.00).round(2)" }

ruby{ code=>"event['vol_KB'] = (event['vol_bytes'] / 1000)" }


(Magnus B├Ąck) #2

See https://www.elastic.co/guide/en/logstash/current/event-api.html#_event_api.


#3

Hans,
the bottom of the page you list ([Breaking changes]https://www.elastic.co/guide/en/logstash/5.x/breaking-changes.html) summarizes what you are facing... see the bottom of the link, under:
'Ruby Filter and Custom Plugin Developers'. It's a nice summary of what changed in ruby filter and how you need to modify your code.

The link Magnus lists goes into the change in more detail.


(Hans) #4

Thank you very much @magnusbaeck and @fh8510, I will go through the documentation and try to find the correct syntax to be compatible in 5 again.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.