# 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:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dishant.sharma](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dishant.sharma](https://discuss.elastic.co/u/dishant.sharma)\
**Post date:** [June 29, 2022, 11:28am UTC](https://discuss.elastic.co/t/accessing-the-previous-value-in-a-field-in-logstash/308462/1 "2022-06-29T11:28:25Z")

</div>

> <https://stackoverflow.com/questions/72800244/accessing-the-previous-value-in-a-field-logstash>

A detailed explanation of the issue is on the above link.

---

<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).

---

<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 27, 2022, 3:47pm UTC](https://discuss.elastic.co/t/accessing-the-previous-value-in-a-field-in-logstash/308462/3 "2022-07-27T15:47:39Z")

</div>

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