# Accessing the previous value in a field in logstash

**URL:** <https://discuss.elastic.co/t/accessing-the-previous-value-in-a-field-in-logstash/308462>\
**Category:** Logstash\
**Created:** [June 29, 2022, 11:28am UTC](https://discuss.elastic.co/t/accessing-the-previous-value-in-a-field-in-logstash/308462 "2022-06-29T11:28:25Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [June 29, 2022, 3:47pm UTC](https://discuss.elastic.co/t/accessing-the-previous-value-in-a-field-in-logstash/308462/2 "2022-06-29T15:47:24Z")

</div>

Relating this topic?

> [@Persist data between log lines with ruby filter](https://discuss.elastic.co/t/persist-data-between-log-lines-with-ruby-filter/206068/2):
>
> You should never need to use global variables. You can do this using an instance variable (@last\_event). You can only use a single worker thread, so the solution does not scale, and you have to use the ruby execution engine because with java\_execution enabled events get [re-ordered](https://github.com/elastic/logstash/issues/10938).

---

_[View the full topic](https://discuss.elastic.co/t/accessing-the-previous-value-in-a-field-in-logstash/308462)._
