# Logstash redis filter goes wrong

**URL:** <https://discuss.elastic.co/t/logstash-redis-filter-goes-wrong/222151>\
**Category:** Logstash\
**Created:** [March 4, 2020, 7:53pm UTC](https://discuss.elastic.co/t/logstash-redis-filter-goes-wrong/222151 "2020-03-04T19:53:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheBigPack](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@TheBigPack](https://discuss.elastic.co/u/TheBigPack)\
**Post date:** [March 4, 2020, 7:53pm UTC](https://discuss.elastic.co/t/logstash-redis-filter-goes-wrong/222151/1 "2020-03-04T19:53:07Z")

</div>

Hello, everybody,

i have the following error messages in the plain-logstash.log  
Ruby exception occurred: undefined method `[]' for #LogStash::Event:0x671fe060

The filter that causes this problem looks like this

filter {  
split {

}  
ruby {  
code =\> "fields = event['message'].split(':')  
event[fields[0]] = fields[1].to\_f"  
}  
}

Does anyone have an idea what I'm doing wrong or how I can fix this mistake?

kind regards, Thomas

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 4, 2020, 9:22pm UTC](https://discuss.elastic.co/t/logstash-redis-filter-goes-wrong/222151/2 "2020-03-04T21:22:28Z")

</div>

Unless you are running a very old version of logstash you cannot refer to the event like that. If you want to add a field to the event use the [event.set API](https://www.elastic.co/guide/en/logstash/current/event-api.html).

---

<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:** [April 1, 2020, 9:22pm UTC](https://discuss.elastic.co/t/logstash-redis-filter-goes-wrong/222151/3 "2020-04-01T21:22:29Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
