# Logstash errors while executing Ruby Code

**URL:** <https://discuss.elastic.co/t/logstash-errors-while-executing-ruby-code/55352>\
**Category:** Logstash\
**Created:** [July 12, 2016, 8:47pm UTC](https://discuss.elastic.co/t/logstash-errors-while-executing-ruby-code/55352 "2016-07-12T20:47:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramdev\_Wudali](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramdev_wudali/32/7894_2.png) [@Ramdev\_Wudali](https://discuss.elastic.co/u/Ramdev_Wudali)\
**Post date:** [July 12, 2016, 8:47pm UTC](https://discuss.elastic.co/t/logstash-errors-while-executing-ruby-code/55352/1 "2016-07-12T20:47:39Z")

</div>

Hi :  
I am trying to calculate the difference between two timestamp fields to see if we have an issue in consuming the data. (the @timestamp field automagically created to indicate index time and date field generated by converting a date String field. )

this is the config :

```
input {
   kafka {
      zk_connect => "zkblah:2181"
      consumer_threads => 1
      topic_id => "blah_topic"
      group_id => "blah_group"
   }
}
filter {
  date {
     match => ["created_at","EEE MMM dd HH:mm:ss Z yyyy"]
     target => "converted_created_at"
  }
  ruby {
    code => "event['diff_time'] = Time.parse(event['@timestamp'] - event['converted_created_at']).to_f "
  }
}

output {
   elasticsearch {
     hosts => "host:9200"
     index => "mutate_follow_filter-%{+YYYY.MM.dd}"
     document_type => "blahblah"
     flush_size => 1000
     workers => 4
   }
# stdout {
# codec => "dots"
# }
}  

```

When I run the logstash process, I get the following error :  
Ruby exception occurred: allocator undefined for Float {:level=\>:error}  
Ruby exception occurred: allocator undefined for Float {:level=\>:error}  
Ruby exception occurred: allocator undefined for Float {:level=\>:error}  
Ruby exception occurred: allocator undefined for Float {:level=\>:error}  
Ruby exception occurred: allocator undefined for Float {:level=\>:error}  
Ruby exception occurred: allocator undefined for Float {:level=\>:error}

is there some magic that I am missing... I am basically trying to do some simple date math and its throwing logstash for a loop.

any and all help is appreciated.

(using logstash 2.2.2, Java 8 and ES 2.1.1)

Thanks

Ramdev

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:48am UTC](https://discuss.elastic.co/t/logstash-errors-while-executing-ruby-code/55352/2 "2017-07-06T04:48:25Z")

</div>


