# Split array fields in logstash

**URL:** <https://discuss.elastic.co/t/split-array-fields-in-logstash/84546>\
**Category:** Logstash\
**Created:** [May 4, 2017, 11:43am UTC](https://discuss.elastic.co/t/split-array-fields-in-logstash/84546 "2017-05-04T11:43:24Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [May 10, 2017, 7:26am UTC](https://discuss.elastic.co/t/split-array-fields-in-logstash/84546/21 "2017-05-10T07:26:11Z")

</div>

You can use the same algorithm, just don't call split on the field. Or better yet, call the array's index function. It returns the index in the array where the specified element is found.

```
event['IndexValue'] = event['id'].index(7)

```

This isn't a Ruby forum so I'll stop here.

---

<div class="post-metadata">

**Author:** ![Aditya\_Srivastava](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aditya_srivastava/32/43287_2.png) [@Aditya\_Srivastava](https://discuss.elastic.co/u/Aditya_Srivastava)\
**Post date:** [May 10, 2017, 10:03am UTC](https://discuss.elastic.co/t/split-array-fields-in-logstash/84546/22 "2017-05-10T10:03:11Z")

</div>

Well thank you for your support and help. The issue got resolved.  
Your community is so responsive and helpful which is one of the reason I prefer using ELK stack.

Though I have a new issue, but I will start a seprate chain for it.

---

<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:** [June 7, 2017, 10:06am UTC](https://discuss.elastic.co/t/split-array-fields-in-logstash/84546/23 "2017-06-07T10:06:44Z")

</div>

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

[Previous page](https://discuss.elastic.co/t/split-array-fields-in-logstash/84546.md?page=1)
