Was trying to execute below code. but logstash keeps spitting an error out.
if [received_at] and [sent_at] {
	ruby {
	  init => "require 'time'"
	  code => "
		received_by_finacle = (Time.parse(event.get('received_at').to_f)*1000).round(2);
		sent_out_by_finacle = (Time.parse(event.get('sent_at').to_f)*1000).round(2);
		event.set('delta', (sent_out_by_finacle - received_by_finacle)).to_s;
		event.set('epoch_received_at_in_milliseconds', received_by_finacle);
		event.set('epoch_sent_at_in_milliseconds', sent_out_by_finacle);
		"
	  add_tag => [ "calculated_time_difference" ]
	}
}  
Error is
[2018-10-10T22:01:05,631][ERROR][logstash.filters.ruby    ] Ruby exception occurred: allocator undefined for Float
[2018-10-10T22:01:05,640][ERROR][logstash.filters.ruby    ] Ruby exception occurred: allocator undefined for Float
[2018-10-10T22:01:05,643][ERROR][logstash.filters.ruby    ] Ruby exception occurred: allocator undefined for Float
[2018-10-10T22:01:05,646][ERROR][logstash.filters.ruby    ] Ruby exception occurred: allocator undefined for Float
[2018-10-10T22:01:05,649][ERROR][logstash.filters.ruby    ] Ruby exception occurred: allocator undefined for Float
Any help will be appreciated please. I am logstash version. 6.2.3