# Decode\_json\_fields and array

**URL:** https://discuss.elastic.co/t/decode-json-fields-and-array/205218
**Category:** Beats
**Tags:** filebeat
**Created:** [October 25, 2019, 9:37am UTC](https://discuss.elastic.co/t/decode-json-fields-and-array/205218 "2019-10-25T09:37:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![granier](https://avatars.discourse-cdn.com/v4/letter/g/b3f665/32.png) [@granier](https://discuss.elastic.co/u/granier)
#### Post date: [October 25, 2019, 9:37am UTC](https://discuss.elastic.co/t/decode-json-fields-and-array/205218/1 "2019-10-25T09:37:35Z")

</div>

Hy,

We use filbeat to store lgo messages in Json format and we use the processor decode\_json\_fields.

We read this post [Condition with decode\_json\_fields processor](https://discuss.elastic.co/t/condition-with-decode-json-fields-processor/115093) and this documentation [Decode JSON fields](https://www.elastic.co/guide/en/beats/journalbeat/7.4/decode-json-fields.html).

We get a problem with logs containing arrays, it seems that the decoder does not parse these logs, even with the parameter process\_array at true.

Sincerly,

B. Granier  
Elasticsearch certified

---

<div class="post-metadata">

### Author: ![faec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/faec/32/46988_2.png) [@faec](https://discuss.elastic.co/u/faec)
#### Post date: [October 25, 2019, 6:22pm UTC](https://discuss.elastic.co/t/decode-json-fields-and-array/205218/2 "2019-10-25T18:22:39Z")

</div>

Sorry you're having trouble! Can you share some examples of log lines that are triggering this problem?

---

<div class="post-metadata">

### Author: ![B.M](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/b.m/32/56771_2.png) [@B.M](https://discuss.elastic.co/u/B.M)
#### Post date: [October 28, 2019, 11:49am UTC](https://discuss.elastic.co/t/decode-json-fields-and-array/205218/3 "2019-10-28T11:49:13Z")

</div>

Hi @faec ,

The problem we're having is that some of our logs are multi-layered with quite a few arrays and some nested objects. We tried using decode\_json\_fields with the process\_array flag set to true, but Filebeat still parce everything that follows '[' in a single field.

This is what we get on Kibana's Display :

```
@timestamp Oct 28, 2019 @ 12:22:06.610
t _id pKEaEm4B7zyLz8s9M8Xe
t _index filebeat-7.3.2-2019.10.28-000001
# _score -
t _type _doc
t agent.ephemeral_id 7c3cd7b7-2f76-424e-a417-5aa82f119bed
t agent.hostname ******
t agent.id 571154fa-e864-49b1-a224-9d405befeddf
t agent.type filebeat
t agent.version 7.3.2
? circuitPath { "policy": "Health Check LB", "execTime": 0, "filters": [ { "class": 
"com.vordel.circuit.attribute.CompareAttributeFilter", "status": "Pass", "filterTime": 
1557733771853, "execTime": 0, "espk": "PrimaryStore-43595d15-05f6-4135-aa9a- 
e8b9b2a35bda:-439438454261778670", "name": "Compare Attribute", "type": 
"CompareAttributeFilter" }, { "execTime": 0, "espk": "PrimaryStore-43595d15-05f6-4135-aa9a- 
e8b9b2a35bda:-6704867506249825459", "name": "Set Message - OK", "type": 
"ChangeMessageFilter", "class": "com.vordel.circuit.conversion.ChangeMessageFilter", "status": 
"Pass", "filterTime": 1557733771853 }, { "execTime": 0, "espk": "PrimaryStore-43595d15-05f6- 
4135-aa9a-e8b9b2a35bda:-5308572925601299001", "name": "Reflect - OK", "type": 
"ReflectFilter", "class": "com.vordel.circuit.net.ReflectFilter", "status": "Pass", "filterTime": 
1557733771853 } ] }
? correlationId *******************
t ecs.version 1.0.1
t host.name *****
t input.type log
t log.file.path *****
# log.offset 747,788
? processInfo.domainId *******************? processInfo.groupId group-2
? processInfo.groupName ******? processInfo.hostname f3slsea310
? processInfo.serviceId instance-6
? processInfo.serviceName ******? processInfo.version 7.6.2 SP1
suricata.eve.timestamp Oct 28, 2019 @ 12:22:06.610
? timestamp 1557733771854

```

And this is an example of one of the logs that we're having a problem with :

```
{"timestamp":1557733646862,"correlationId":" ***************","processInfo":{"hostname":"f3slsea310","domainId":"*******************","groupId":"group-2","groupName":" *****","serviceId":"instance-6","serviceName":"*******","version":"7.6.2 SP1"},"circuitPath":[{ "policy": "Health Check LB", "execTime": 0, "filters": [ { "espk": "PrimaryStore-43595d15-05f6-4135-aa9a-e8b9b2a35bda:-439438454261778670", "name": "Compare Attribute", "type": "CompareAttributeFilter", "class": "com.vordel.circuit.attribute.CompareAttributeFilter", "status": "Pass", "filterTime": 1557733646861, "execTime": 0 } , { "espk": "PrimaryStore-43595d15-05f6-4135-aa9a-e8b9b2a35bda:-6704867506249825459", "name": "Set Message - OK", "type": "ChangeMessageFilter", "class": "com.vordel.circuit.conversion.ChangeMessageFilter", "status": "Pass", "filterTime": 1557733646861, "execTime": 0 } , { "espk": "PrimaryStore-43595d15-05f6-4135-aa9a-e8b9b2a35bda:-5308572925601299001", "name": "Reflect - OK", "type": "ReflectFilter", "class": "com.vordel.circuit.net.ReflectFilter", "status": "Pass", "filterTime": 1557733646861, "execTime": 0 }] } ]}

```

Filebeat.yml

```
processors:
   - decode_json_fields:
       fields: [message]
       process_array: true
       overwrite_keys: true
```

---

<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: [November 25, 2019, 11:56am UTC](https://discuss.elastic.co/t/decode-json-fields-and-array/205218/4 "2019-11-25T11:56:22Z")

</div>

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