# Json Parsing to Elastic Search using filebeat

**URL:** https://discuss.elastic.co/t/json-parsing-to-elastic-search-using-filebeat/110557
**Category:** Beats
**Tags:** filebeat
**Created:** [December 6, 2017, 6:24pm UTC](https://discuss.elastic.co/t/json-parsing-to-elastic-search-using-filebeat/110557 "2017-12-06T18:24:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![john.akash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john.akash/32/18707_2.png) [@john.akash](https://discuss.elastic.co/u/john.akash)
#### Post date: [December 6, 2017, 6:24pm UTC](https://discuss.elastic.co/t/json-parsing-to-elastic-search-using-filebeat/110557/1 "2017-12-06T18:24:04Z")

</div>

Hi Team,

I am trying to push some audit logs which are in json format to ES from a docker container. Could you please let us know how can we perform it using filebeat (without logstash)?

Filebeat Version: 6.0.0  
Elastic Search: 5.6

Sample Data  
{"time":"2017-12-05T19:29:57Z","type":"request","auth":{"client\_token":"hmac-sha256:88838df166cba1c6c5918d0156fcea93e2fdaed57529f83be8a90747995a382e","accessor":"hmac-sha256:55d6b114f6754c45ee33768b3d4b36a1fbbaee1c60fa737fc0d4b18efda68412","display\_name":"ldap-user1","policies":["default","r\_ldap\_wer","ldapadmin","w\_use\_bin","welcome"],"metadata":{"policies":"default,r\_shared\_21334,w\_use\_bin","username":"welcome"}},"request":{"id":"f0057990-9811-6b90-c7cd-73e3fc737acf","operation":"list","client\_token":"hmac-sha256:88838df166cba345345435435431c6c5918d0156fcea93e2fdaed57529f83be8a90747995a382e","client\_token\_accessor":"hmac-sha256:55d6b114f64534543534754c45ee33768b3d4b36a1fbbaee1c60fa737fc0d4b18efda68412","path":"metadata/users/","data":null,"remote\_address":"172.17.0.1","wrap\_ttl":0,"headers":{}},"error":""}

---

<div class="post-metadata">

### Author: ![john.akash](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john.akash/32/18707_2.png) [@john.akash](https://discuss.elastic.co/u/john.akash)
#### Post date: [December 7, 2017, 3:54am UTC](https://discuss.elastic.co/t/json-parsing-to-elastic-search-using-filebeat/110557/2 "2017-12-07T03:54:19Z")

</div>

I got the solution and the solution is

```
filebeat configuration 
    filebeat.prospectors:
- input_type: log
  paths:
    - /root/vaultlogs/tvault-vault_audit.log
  json.keys_under_root: true
  json.add_error_key: true
  json.message_key: log
output.elasticsearch:
  hosts: ["10.65.228.156:9200"]
  template:
    name: "app"
    path: "app.template.json"
  indices:
    - index: "app-audit-%{+MM.yyyy}"

```

There should be a template file in in the /etc/filebeat/ localtion

```
{
  "index_patterns": [
    "app-audit-*"
  ],
  "mappings": {
    "type1": {
      "_source": {
        "enabled": false
      },
      "properties": {
        "time": {
          "format": "YYYY-MM-dd'T'HH:mm:ssZ",
          "type": "date"
        }
      }
    },
    "aliases": {
      "team-app-auditlog": {

      }
    }
  },
  "order": 1,
  "settings": {
    "index": {
      "mapping": {
        "total_fields": {
          "limit": 10000
        }
      },
      "refresh_interval": "5s"
    }
  }
}
```

---

<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: [January 4, 2018, 3:54am UTC](https://discuss.elastic.co/t/json-parsing-to-elastic-search-using-filebeat/110557/3 "2018-01-04T03:54:44Z")

</div>

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