# Problem with JSON logs

**URL:** https://discuss.elastic.co/t/problem-with-json-logs/167687
**Category:** Beats
**Tags:** filebeat
**Created:** [February 8, 2019, 9:14pm UTC](https://discuss.elastic.co/t/problem-with-json-logs/167687 "2019-02-08T21:14:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Utundu](https://avatars.discourse-cdn.com/v4/letter/u/53a042/32.png) [@Utundu](https://discuss.elastic.co/u/Utundu)
#### Post date: [February 8, 2019, 9:14pm UTC](https://discuss.elastic.co/t/problem-with-json-logs/167687/1 "2019-02-08T21:14:27Z")

</div>

Hi,

I'm new to the Elastic Stack and I can't manage to build a pipeline for my Java logs.  
I use the Logstack Logstash appender, Filebeat and Elastic Search for now.

Here is my Filebeat configuration.

```auto
    filebeat.inputs:
    - type: log
      enabled: true
      paths:
        - /var/log/myApp/stash_*
      fields_under_root: true
      fields:
        app_id: myApp
        env: dev
    output.elasticsearch:
      hosts: ["http://MyES:9200"]

```

It does generate entries in ES:

> "@timestamp": "2019-02-08T19:52:36.371Z",  
> "app\_id": "myApp",  
> ...  
> "message": "{"@timestamp":"2019-02-08T20:52:36.329+01:00","@version":"1","message":"[Application] At path /data/","logger\_name":"application","thread\_name":"application-akka.actor.default-dispatcher-155","level":"DEBUG","level\_value":10000}",  
> ...

As you can see, the message is stored as plain text instead of JSON.

What am I missing ?

Thanks in advance

---

<div class="post-metadata">

### Author: ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)
#### Post date: [February 9, 2019, 2:17am UTC](https://discuss.elastic.co/t/problem-with-json-logs/167687/2 "2019-02-09T02:17:38Z")

</div>

You need to configure log input to decode JSON. See [https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-log.html#filebeat-input-log-config-json](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-log.html#filebeat-input-log-config-json).

```auto
filebeat.inputs:
- type: log
  json.message_key: message
  ...

```

---

<div class="post-metadata">

### Author: ![Utundu](https://avatars.discourse-cdn.com/v4/letter/u/53a042/32.png) [@Utundu](https://discuss.elastic.co/u/Utundu)
#### Post date: [February 9, 2019, 5:31pm UTC](https://discuss.elastic.co/t/problem-with-json-logs/167687/3 "2019-02-09T17:31:29Z")

</div>

Of course !  
Working great, thanks a lot ! 🙂

---

<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: [March 9, 2019, 7:31pm UTC](https://discuss.elastic.co/t/problem-with-json-logs/167687/4 "2019-03-09T19:31:33Z")

</div>

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