Ruby filter in Logstash, how to pass parameters to external Ruby script

https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#sprintf

However, what you're trying to do doesn't make sense. The script parameters are passed to the ruby filter's register function (as you've noticed) but that code is run when the pipeline starts up. At that point there is no event context so you can't possibly pass field values from an event.

If you really want to access field values in your ruby filter you can just access them via the event object straight in your code.

1 Like