# Logstash 5.0 :Ruby exception occurred

**URL:** <https://discuss.elastic.co/t/logstash-5-0-ruby-exception-occurred/63562>\
**Category:** Logstash\
**Created:** [October 21, 2016, 3:57am UTC](https://discuss.elastic.co/t/logstash-5-0-ruby-exception-occurred/63562 "2016-10-21T03:57:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![suntuo](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@suntuo](https://discuss.elastic.co/u/suntuo)\
**Post date:** [October 21, 2016, 3:57am UTC](https://discuss.elastic.co/t/logstash-5-0-ruby-exception-occurred/63562/1 "2016-10-21T03:57:54Z")

</div>

The filter works fine with logstash 2.X, when it upgrade to 5.0  
Ruby exception occurred: undefined method `[]'

ruby {  
init =\>"@kname =['time\_local','jsoncontent']"  
code =\>"event.append(Hash[@kname.zip(event['message'].split(' INFO '))])"  
}

input: 2016-10-20 11:04:25,197 INFO {json}

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 23, 2016, 5:00pm UTC](https://discuss.elastic.co/t/logstash-5-0-ruby-exception-occurred/63562/2 "2016-10-23T17:00:42Z")

</div>

Logstash 5 has a new event API. `event` no longer has the API of a hash; it uses `get` and `set` methods, so `event["message"]` needs to be `event.get("message")`. I'm not sure what `event.append` should be replaced with.

---

<div class="post-metadata">

**Author:** ![suntuo](https://avatars.discourse-cdn.com/v4/letter/s/bb73d2/32.png) [@suntuo](https://discuss.elastic.co/u/suntuo)\
**Post date:** [October 24, 2016, 7:55am UTC](https://discuss.elastic.co/t/logstash-5-0-ruby-exception-occurred/63562/3 "2016-10-24T07:55:21Z")

</div>

Thanks magnus  
Is there any reference guide for ruby-plugin API ?  
or how to split the message field into 2 new fields with other filter

---

<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:33am UTC](https://discuss.elastic.co/t/logstash-5-0-ruby-exception-occurred/63562/4 "2017-07-06T04:33:06Z")

</div>


