sometimes I used ruby as logstash filter plugin - only the inline functionality until now. Additionally I have to admit, that I am not really fond of ruby.
Now I wanna outsource the code to a script file, but I do not understand the explanation at https://www.elastic.co/guide/en/logstash/current/plugins-filters-ruby.html
I would like to do the following:
- create a field which has the current timestamp as value and store it in the event
- set a part of the name as variable (variable name)
Following ruby code snipped should work:
myTime=timeStart=DateTime.now.strftime("%Q").to_i event.set("[logstash][debug][" + name + "]",myTime )
But I do not understand how to outsource this to a file and how to give the name as parameter.
Can anyone provide an example on this simple issue?