I'm trying to take a pair of fields that contain a date and subtract one from the other. However, my code is wrong somewhere and i get an error. This error occurs three times for each event, so I assume it's a syntax error in all three ruby filters I use in this pipeline.
[ERROR][logstash.filters.ruby ] Ruby exception occurred: undefined method `[]' for #<LogStash::Event:0x5e20cf07>`
Here's what i have in the pipeline.
##convert old.sys_updated date/time data type to epoch
ruby { code => "event['old.sys_updated_epoch'] = event['old.sys_updated_time'].to_i" }
#Convert current timestamp to epoch
ruby { code => "event['currenttime_epoch'] = event['sys_updated_on'].to_i" }
#Calculate difference between old.sys_updated_epoch and currenttime_epoch
ruby { code => "event['duration_epoch'] = event['currenttime_epoch'] - event['old.sys_updated_epoch']" }
[ERROR][logstash.filters.ruby ] Ruby exception occurred: wrong number of arguments calling `set` (given 0, expected 2)
Giving another read of this documentation, I used the example at the very bottom to correct the syntax and get a functional line of code. Here's the working value.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.