# We are getting Ruby exception error in logstash

**URL:** <https://discuss.elastic.co/t/we-are-getting-ruby-exception-error-in-logstash/319188>\
**Category:** Logstash\
**Created:** [November 17, 2022, 12:21pm UTC](https://discuss.elastic.co/t/we-are-getting-ruby-exception-error-in-logstash/319188 "2022-11-17T12:21:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [November 17, 2022, 5:02pm UTC](https://discuss.elastic.co/t/we-are-getting-ruby-exception-error-in-logstash/319188/2 "2022-11-17T17:02:46Z")

</div>

The event.get is returning nil, meaning the field does not exist. You can either save the result of event.get in a local variable and use a conditional before using it, or [wrap](https://discuss.elastic.co/t/locate-json-field-with-jsonpath-logstash/318812/2) the .get/.set in begin/rescue/end.

---

_[View the full topic](https://discuss.elastic.co/t/we-are-getting-ruby-exception-error-in-logstash/319188)._
