Use logstash to combine fields of nested object into one array of values


(Jettro Coenradie) #1

Hi I am having a challenge which I did not find a solution for yet. I am using logstash to parse some input documents and I would like to do the following:

{
  "groups": [
    {
      "id": 1,
      "name": "one"
    },
    {
      "id": 2,
      "name": "two"
    }
  ]
}

I'd like this to become:

{
  "groups":["1-one","2-two"]
}

Is this possible? And if it is possible, how?


(shadyabhi) #2

If you know how to write ruby code, you can do that with the ruby filter.

I'm not answering your question directly but I had to do some manipulation of arrays the other day and this is the approach I took. http://blog.abhijeetr.com/2016/11/logstashelasticsearch-best-way-to.html

I'm sure it's a good starting point and you should be able to achieve what you want to do.


(system) #3

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