# How to concatenate fields inside an array using Logstash?

**URL:** <https://discuss.elastic.co/t/how-to-concatenate-fields-inside-an-array-using-logstash/100148>\
**Category:** Logstash\
**Created:** [September 12, 2017, 2:06am UTC](https://discuss.elastic.co/t/how-to-concatenate-fields-inside-an-array-using-logstash/100148 "2017-09-12T02:06:44Z")\
**Posts on this page:** 1\
**Showing post:** 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:** [September 12, 2017, 6:01am UTC](https://discuss.elastic.co/t/how-to-concatenate-fields-inside-an-array-using-logstash/100148/2 "2017-09-12T06:01:39Z")

</div>

That's not an array, it's a hash or an object depending on which terminology you want to stick to.

You'll have to use a ruby filter. If you don't care about the names of the keys, just the values, this piece of Ruby should work:

```
event.set('some-field-name', event.get('event_data').values.sort.join(','))
```

---

_[View the full topic](https://discuss.elastic.co/t/how-to-concatenate-fields-inside-an-array-using-logstash/100148)._
