# Ruby exception occurred: undefined method \`\[\]' for nil:NilClas

**URL:** <https://discuss.elastic.co/t/ruby-exception-occurred-undefined-method-for-nil-nilclas/143750>\
**Category:** Logstash\
**Created:** [August 9, 2018, 6:55pm UTC](https://discuss.elastic.co/t/ruby-exception-occurred-undefined-method-for-nil-nilclas/143750 "2018-08-09T18:55:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikaelLindstrom](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@MikaelLindstrom](https://discuss.elastic.co/u/MikaelLindstrom)\
**Post date:** [August 9, 2018, 6:55pm UTC](https://discuss.elastic.co/t/ruby-exception-occurred-undefined-method-for-nil-nilclas/143750/1 "2018-08-09T18:55:22Z")

</div>

Hi all,  
We're seeing these two messages in the logs:

/var/log/logstash/logstash-plain.log:  
[2018-08-09T05:13:41,528][ERROR][logstash.filters.ruby] Ruby exception occurred: undefined method `[]' for nil:NilClass

When we add stdout {  
codec =\> rubydebug  
}  
to logstash output, we also see this error in the /var/log/messages:  
Aug 9 05:13:41 labelk kibana: {"type":"log","@timestamp":"2018-08-09T12:13:41Z","tags":["plugin","debug"],"pid":20218,"message":"Checking Elasticsearch version"}

which points to the kibana checking the elasticversion triggering this ruby exception.

Has anyone seen this and found a fix?

Regards,  
Mike

---

<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:** [August 9, 2018, 7:01pm UTC](https://discuss.elastic.co/t/ruby-exception-occurred-undefined-method-for-nil-nilclas/143750/2 "2018-08-09T19:01:08Z")

</div>

It's unrelated to Kibana. In your logstash configuration you have a ruby filter, and it is trying to index into a variable that is nil. What does your ruby filter look like?

---

<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:** [September 6, 2018, 7:01pm UTC](https://discuss.elastic.co/t/ruby-exception-occurred-undefined-method-for-nil-nilclas/143750/3 "2018-09-06T19:01:15Z")

</div>

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