Filebeat not filtering data according to fields in decode_json_fields

In my filebeat configuration, I am trying pass json file to filebeat and want specific fields in the json to filtered and passed to elasticsearch. I am not using logstash. Below is my filebeat config:

- type: log
     - /var/log/test4*.json
  json.keys_under_root: true
  json.add_error_key: true
    - decode_json_fields:
        fields: ["header"]
        process_array: false
         max_depth: 1

Example of my json file:

{"header1": "nissan"},
{"header": "mazda"},
{"header": "honda","cars":[ "civic", "accord", "clarity" ] }

I would like only the following to sent to Elasticsearch.

{"header": "mazda"},
{"header": "honda"}

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