# How to stop logstash when ruby filter encountered error

**URL:** https://discuss.elastic.co/t/how-to-stop-logstash-when-ruby-filter-encountered-error/267899
**Category:** Logstash
**Created:** [March 21, 2021, 7:50am UTC](https://discuss.elastic.co/t/how-to-stop-logstash-when-ruby-filter-encountered-error/267899 "2021-03-21T07:50:47Z")
**Posts on this page:** 1
**Showing post:** 3

<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 21, 2021, 3:56pm UTC](https://discuss.elastic.co/t/how-to-stop-logstash-when-ruby-filter-encountered-error/267899/3 "2021-03-21T15:56:25Z")

</div>

If you actually want to exit the logstash process then see [here](https://discuss.elastic.co/t/stop-logstash-with-a-filter-or-ruby-code/259000/4). If you want to drop the events when you get an error you can call event.cancel in the ruby filter.

---

_[View the full topic](https://discuss.elastic.co/t/how-to-stop-logstash-when-ruby-filter-encountered-error/267899)._
