[Filter ruby plugin] How to add exception message to event?

Exceptions may be thrown when working with ruby filter.
Now the event logs only the fact that there was an exception, but it is not informative.
is it possible to add exception message to tags?

I propose to add the ability to enable such functionality using the parameter in the plugin configuration. for example:

filter {
  ruby {
   code => "event.cancel if rand <= 0.90"
   enable_exception_message => true #for adding exception message
  }
}

result event:

tags": [
        """_rubyexception: undefined local variable or method `randd' for #<LogStash::Filters::Ruby:0x78a8dafb>
Did you mean?  rand
           srand"""
      ]

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