I am trying to fetch a .json file through filebeat to send logs to logstash. But it throws an error as
"tags" => [
[0] "beats_input_raw_event"

My filebeat.yml has following configuration:

  • type: log
    enabled: true


    • ./test_sample.json
      json.keys_under_root: true
      json.add_error_key: true

My json file has following data
{"name": "Rhonda Levine","department": "Development","email": ""},
{"name": "Mcgee Klein","department": "Accounts","email": "" },
{"name": "Dixon Poole","department": "HR","email": ""},
{"name": "Blackwell Hill","department": "Development","email": ""},
{"name": "Leonor Mack","department": "Accounts","email": ""},
{"name": "Corrine Howe","department": "Development","email": ""},
{"name": "Sondra Flores","department": "HR","email": ""},
{"name": "Farley Shaw","department": "Development","email": ""},
{"name": "Mcpherson Patterson","department": "HR","email": ""},
{"name": "Preston Lucas","department": "Development","email": ""},
{"name": "Hester Butler","department": "Development","email": ""},
{"name": "Fay Burris","department": "Accounts","email": ""},
{"name": "Deena Benton","department": "Development","email": ""},
{"name": "Mclean Carrillo","department": "MEDESIGN","email": ""},
{"name": "Daniels Good","department": "KONNECT","email": ""},
{"name": "Marietta Evans","department": "Development","email": ""},
{"name": "Angeline Cantu","department": "Development","email": ""},
{"name": "Macdonald Atkins","department": "Development","email": ""},
{"name": "Mooney Bennett","department": "Accounts","email": ""}

Please help!

What is your expected outcome? The above looks like a json array with a json doc on each line. Do you expect all to end up as one event in Elasticsearch / Logstash?

Hey Ruflin thanks for your reply. Some changes in filebeat.yml file worked fine for me. Results are attached in attachment which is as expected. Now I want to render a graph from Visualize section to show Department wise data but I am not able to find Development field in field list. Please help for the same.

The changes in filebeat.yml are as follows :

- ./test_sample.json
json.keys_under_root: true
json.add_error_key: true

Actually I just want to pass data to elastic search from filebeat from JSON file. In above example I would like to treat each object as a record in log file. Can you please suggest a json file format, which can be used for the purpose mentioned above? Thanks

I thin the problem in your case is that Filebeat sends up all as one event (which is expected) and then you have nested objects in Elasticsearch:

If you want each line to be an event, you probably have to go trough logstash for more complex processing or alternative if you are in control of the logger, log one json even per line.

I am not exactly getting it. Please find attachment,

Discover section shows each json object as a record from file and the graph shows count which is equal to no. of objects in my .json file. So, I think the problem has been solved. If I am wrong can you please suggest json file structure as I am in control of the logger and also I am stuck while showing Department wise graphs in Visualize section, as Department is not getting displayed in field list.
Please help

All good if you got the expect result :+1:

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