# How to change Array(list) to field with filter pipeline of Logstash?

**URL:** https://discuss.elastic.co/t/how-to-change-array-list-to-field-with-filter-pipeline-of-logstash/271327
**Category:** Logstash
**Tags:** ingest-pipeline
**Created:** [April 27, 2021, 7:34am UTC](https://discuss.elastic.co/t/how-to-change-array-list-to-field-with-filter-pipeline-of-logstash/271327 "2021-04-27T07:34:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Farid\_N](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/farid_n/32/74144_2.png) [@Farid\_N](https://discuss.elastic.co/u/Farid_N)
#### Post date: [April 27, 2021, 7:34am UTC](https://discuss.elastic.co/t/how-to-change-array-list-to-field-with-filter-pipeline-of-logstash/271327/1 "2021-04-27T07:34:23Z")

</div>

Hi there

I elaborate my issue with an instance:

Imagine bellow log (The field `"events"` is an array , there are more fields in the log but I ignore them to write and just wrote down the field `"events"`)

```auto
    "events": [
      {
        "Level": "Error",
        "MessageTemplate": "Error In {BehaviorName}{CurrentEvent}{ContractId}",
        "Exception": "System.ApplicationException",
        "Properties": {
          "ProcessName": "CRM",
          "CurrentEvent": "DSLAM",
          "SourceContext": "Workflow",
          "MachineName": "Machine1",
          "ContractId": 0052986,
          "BehaviorName": "Port",
          "ThreadId": 44,
          "Source": "NOC"
        },
        "Timestamp": "2021-04-27T10:58:51.9752113"
      }
    ],

```

My problem is, all the contents like `"ProcessName":"CRM"` , `"Source":"NOC"` , `"BehaviorName":"Port"` and... they're index 0 of the list `"events"`. all of them are in [0]

But something like the bellow log:

```auto
    "root": {
      "ThreadId": 1,
      "ApplicationName": "Shift",
      "ProcessId": 1,
      "ProcessName": "dotnet",
      "MachineName": "My_Machine"
    }

```

The second one is a dictionary (for example I can say : `"root.ProcessId"`)

Here's the deal, I want to make a filter in Logstash to convert the Array into field. I mean every content of `"events[0]"` consider as fields (or maybe like the second log, as a dictionary).

In short. I want the first log like bellow:

```auto
   "events": 
      {
        "Level": "Error",
        "MessageTemplate": "Error In {BehaviorName}{CurrentEvent}{ContractId}",
        "Exception": "System.ApplicationException",
        "Properties": {
          "ProcessName": "CRM",
          "CurrentEvent": "DSLAM",
          "SourceContext": "Workflow",
          "MachineName": "Machine1",
          "ContractId": 0052986,
          "BehaviorName": "Port",
          "ThreadId": 44,
          "Source": "NOC"
        },
        "Timestamp": "2021-04-27T10:58:51.9752113"
      }

```

So I can say for example: `"events.Properties.ProcessName"`

I hope I was able to explain what I meant  
Thanks in advance

---

<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: [April 27, 2021, 3:03pm UTC](https://discuss.elastic.co/t/how-to-change-array-list-to-field-with-filter-pipeline-of-logstash/271327/2 "2021-04-27T15:03:01Z")

</div>

Try using a split filter

```
split { field => "events" }
```

---

<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: [May 25, 2021, 3:03pm UTC](https://discuss.elastic.co/t/how-to-change-array-list-to-field-with-filter-pipeline-of-logstash/271327/3 "2021-05-25T15:03:27Z")

</div>

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