How to call Ruby function in logstash filter?

I don't want to write too much Ruby code in filter(Ruby filter) ,because it's hard to maintenance, can logstash filter call user defined function?
Like I have a business function: foo(x) in the file: my.rb as below:

def foo(x)  
	#business code here
end

How to call this function in logstash filter?

Can anyone help?

The latest version of the ruby filter includes support for loading the ruby code from a file (v3.1.1, updated in LS 6.0.0)

The file needs to be in a certain format.


You can define as many methods as you need for better code execution and there is a micro test harness too.

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