# Make a loop to read values in logstash

**URL:** <https://discuss.elastic.co/t/make-a-loop-to-read-values-in-logstash/290692>\
**Category:** Logstash\
**Created:** [December 1, 2021, 4:09pm UTC](https://discuss.elastic.co/t/make-a-loop-to-read-values-in-logstash/290692 "2021-12-01T16:09:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elpazo](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@elpazo](https://discuss.elastic.co/u/elpazo)\
**Post date:** [December 1, 2021, 4:09pm UTC](https://discuss.elastic.co/t/make-a-loop-to-read-values-in-logstash/290692/1 "2021-12-01T16:09:30Z")

</div>

Hello,

I have a result like this  
' values [  
[0] { X = 1  
Y = 2  
Z = 3  
V = 4  
}  
[1] { X = 5  
Y = 6  
Z = 7  
V= 8  
}  
'

How can i read this result and put every value in variable (example Var\_X = Values[0][0] = 1, Var\_Y = Values[0][1] = 2, after that, in the output Block i will inject them in a csv file  
Thank you for your help

---

<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:** [December 1, 2021, 8:04pm UTC](https://discuss.elastic.co/t/make-a-loop-to-read-values-in-logstash/290692/2 "2021-12-01T20:04:28Z")

</div>

It is unclear what result you are looking for. You seem to want

```
"Var_X" => 1
"Var_Y" => 2

```

and I can infer from that what you want for Var\_Z and Var\_V, but what do you want for the second hash in the array?

---

<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:** [December 29, 2021, 8:04pm UTC](https://discuss.elastic.co/t/make-a-loop-to-read-values-in-logstash/290692/3 "2021-12-29T20:04:46Z")

</div>

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