[Resolved] Ruby filter exceptions in 5.0.0

Hi,

I want to create a new field by computing hour, minute and second in seconds with logstash 5.0.0-alpha4.
I'm using :

ruby {
code => "event['duration'] = event['dur_hour'] * 3600 + event['dur_min'] * 60 + event['dur_sec']"
remove_field => ["dur_hour", "dur_min", "dur_sec"]
}

The fields dur_hour, dur_min and dur_sec are integers :

  • grok pattern = "%{HOUR:dur_hour:int}:%{MINUTE:dur_min:int}:%{SECOND:dur_sec:int}"
  • the result is

"dur_hour" => 0,
"dur_sec" => 1,
"dur_min" => 1,

I've got a _rubyexception that I can't explain

If I put an empty code (like code => "" or ";") there is no exception (I checked it by adding a remove_filed command to delete dur_hour)
If I put a simple code (like event['duration'] = 1000) there is an exception : _rubyexception

How can I debug ruby to have more information ?
Is this problem linked to the version of logstash ?

Thank for your help

EDIT :
Some more information,

  • the code above works with Logstash 2.3.4.
  • When I start Logstash 5.0.0-alpha4 I've this message :

--- jar coordinate com.fasterxml.jackson.core:jackson-annotations already loaded with version 2.7.1 - omit version 2.7.0 --- jar coordinate com.fasterxml.jackson.core:jackson-databind already loaded with version 2.7.1 - omit version 2.7.1-1

SOLUTION
Ruby getters and setters have been refactored in 5.0.0
Found there : https://github.com/elastic/logstash/issues/5141

This works fine :

code => "event.set('duration', event.get('dur_hour') * 3600 + event.get('dur_min') * 60 + event.get('dur_sec'))"