# Ruby Filter Question

**URL:** <https://discuss.elastic.co/t/ruby-filter-question/43371>\
**Category:** Logstash\
**Created:** [March 3, 2016, 11:14am UTC](https://discuss.elastic.co/t/ruby-filter-question/43371 "2016-03-03T11:14:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kryten](https://avatars.discourse-cdn.com/v4/letter/k/58956e/32.png) [@Kryten](https://discuss.elastic.co/u/Kryten)\
**Post date:** [March 3, 2016, 11:14am UTC](https://discuss.elastic.co/t/ruby-filter-question/43371/1 "2016-03-03T11:14:12Z")

</div>

Hi,

I'm experimenting with the ruby filter to execute arbitrary ruby code on events and so far, its been very successful, but I have a couple of questions please.

[1] Is it possible to persist data between events? I appreciate that each log event is processed separately but wondered whether perhaps a variable could be 'global' and persist from event to event?

[2] Is it possible to call other ruby code from within that filter? For example would it be feasible to call an external ruby script and still have access to event['field'] type data?

Would be grateful for any pointers or resources which describe whats possible with this filter.  
Thanks

---

<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, 5:08am UTC](https://discuss.elastic.co/t/ruby-filter-question/43371/2 "2017-07-06T05:08:36Z")

</div>


