# FileBeat: decode\_json\_fields processor max\_depth option not working

**URL:** https://discuss.elastic.co/t/filebeat-decode-json-fields-processor-max-depth-option-not-working/285836
**Category:** Beats
**Tags:** filebeat
**Created:** [October 4, 2021, 3:40pm UTC](https://discuss.elastic.co/t/filebeat-decode-json-fields-processor-max-depth-option-not-working/285836 "2021-10-04T15:40:37Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Denis\_Baryshev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/denis_baryshev/32/37620_2.png) [@Denis\_Baryshev](https://discuss.elastic.co/u/Denis_Baryshev)
#### Post date: [October 4, 2021, 3:40pm UTC](https://discuss.elastic.co/t/filebeat-decode-json-fields-processor-max-depth-option-not-working/285836/1 "2021-10-04T15:40:37Z")

</div>

Plz review

> <https://github.com/elastic/beats/issues/19830>
>
> To prevent creating tons of document fields in an Elasticsearch log index I want… to control nested JSON parsing depth.
> 
> Related discussion post: https://discuss.elastic.co/t/filebeat-decode-json-fields-processor-max-depth-option-not-working/240948
> 
> Filebeat version 7.8.0 (also tested on 6.8.10 and result is the same)
> 
> /tmp/filebeat.conf:
> 
> \`\`\`
> filebeat.inputs:
> \- type: log
> paths:
> - /tmp/filebeat.input
> 
> processors:
> - decode\_json\_fields:
> fields: \["message"\]
> max\_depth: 1
> target: "parsed"
> 
> output.console:
> pretty: true
> \`\`\`
> 
> /tmp/filebeat.input:
> 
> \`\`\`
> {"top": "top\_value", "top\_obj": {"level\_1": "level\_1\_value", "level\_1\_obj": {"level\_2": "level\_2\_value", "level\_2\_obj": {"level\_3": "level\_3\_value"}}}}
> \`\`\`
> 
> Command:
> 
> \`\`\`
> filebeat -e -c /tmp/filebeat.conf
> \`\`\`
> 
> Result:
> 
> \`\`\`
> "parsed": {
> "top\_obj": {
> "level\_1\_obj": {
> "level\_2": "level\_2\_value",
> "level\_2\_obj": {
> "level\_3": "level\_3\_value"
> }
> },
> "level\_1": "level\_1\_value"
> },
> "top": "top\_value"
> }
> \`\`\`
> 
> Expected result:
> 
> \`\`\`
> "parsed": {
> "top\_obj": {
> "level\_1\_obj": "{\\"level\_2\\": \\"level\_2\_value\\", \\"level\_2\_obj\\": {\\"level\_3\\": \\"level\_3\_value\\"}}",
> "level\_1": "level\_1\_value"
> },
> "top": "top\_value"
> }
> \`\`\`

---

<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 1, 2021, 5:41pm UTC](https://discuss.elastic.co/t/filebeat-decode-json-fields-processor-max-depth-option-not-working/285836/2 "2021-11-01T17:41:23Z")

</div>

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