# Logstash create and reference variables

**URL:** <https://discuss.elastic.co/t/logstash-create-and-reference-variables/251348>\
**Category:** Logstash\
**Created:** [October 7, 2020, 10:28pm UTC](https://discuss.elastic.co/t/logstash-create-and-reference-variables/251348 "2020-10-07T22:28:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohsin106](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohsin106/32/65203_2.png) [@mohsin106](https://discuss.elastic.co/u/mohsin106)\
**Post date:** [October 7, 2020, 10:28pm UTC](https://discuss.elastic.co/t/logstash-create-and-reference-variables/251348/1 "2020-10-07T22:28:41Z")

</div>

Hi,

Is there a way to pull and field:value from one event, store it in some sort of variable and then add it to the next event?

**For example:**  
event1: {device:"router1", in-rate:"1", out-rate:"2", interface:"eth01", description:"test router"}  
event2: (device:"router1", cpu1:"10", cpu2:"20", interface:"eth01"}

I want to add the description from event1 to event2. Is this possible to do with ruby code?

Thank you.

---

<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:** [November 4, 2020, 10:28pm UTC](https://discuss.elastic.co/t/logstash-create-and-reference-variables/251348/2 "2020-11-04T22:28:45Z")

</div>

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