# Parsing JSON in JSON (docker logs)

**URL:** <https://discuss.elastic.co/t/parsing-json-in-json-docker-logs/65663>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [November 10, 2016, 1:03pm UTC](https://discuss.elastic.co/t/parsing-json-in-json-docker-logs/65663 "2016-11-10T13:03:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@Jeff](https://discuss.elastic.co/u/Jeff)\
**Post date:** [November 10, 2016, 1:03pm UTC](https://discuss.elastic.co/t/parsing-json-in-json-docker-logs/65663/1 "2016-11-10T13:03:54Z")

</div>

We are parsing docker logs using filebeat 5. We parse the JSON using the following options:

json.message\_key: log  
json.keys\_under\_root: true  
json.add\_error\_key: true

However, the log messages from the docker container are being generated using logstash-logback-encoder and are structured logs in JSON. So ideally I want to parse the JSON docker log, then parse the value of the log key in JSON again.

e.g. docker log file entry:  
{"log":"{"msg": "hello", "level": "WARN"}","stream":"stdout","time":"2016-11-10T12:55:37.707457521Z"}

I would like to get msg and level as keys in the elasticsearch entry.

Is this possible?

Regards,  
Jeff

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [November 10, 2016, 1:12pm UTC](https://discuss.elastic.co/t/parsing-json-in-json-docker-logs/65663/2 "2016-11-10T13:12:05Z")

</div>

Sounds like [this PR](https://github.com/elastic/beats/pull/2605) could become helpful in the future. Right now, additional json decoding must be done in logstash or via elasticsearch ingest node.

---

<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:** [December 8, 2016, 1:12pm UTC](https://discuss.elastic.co/t/parsing-json-in-json-docker-logs/65663/3 "2016-12-08T13:12:08Z")

</div>

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