Logstash 5 beta 1: Ruby exception occurred: undefined method `[]'

Hi,
I am currently playing around with logstash 5 beta 1.

When I use my filter settings, which are fine with 2.3.4 I get now a ruby exception:

Ruby exception occurred: undefined method `[]'...

my filter code is as followed:

filter
{
        ruby
        {
            code =>
            "
                m = event['message'].to_s
                puts m
                event['added_field'] = 'hallo'.to_s
            "
        }
}

I used event[] to add, update or read from fields of the event.
What do I need to use in Logstash 5? Is there a syntax which is working in logstash 1.5 to 5.0 ?

ok, I shortly after I posted I found the solution:


So I need to use the following code, then it works:

filter
{
        ruby
        {
            code =>
            "
                m = event.get('message').to_s
                puts m
                event.set('added_field', 'hallo'.to_s)
            "
        }
}