-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
Milestone
Description
Hi, I think there is a bug in how JSON array entries are being parsed by JSONQuery. Would really appreciate guidance on whether I've made a configuration error or this is indeed reproducible by other folks.
Relevant telegraf.conf:
[[inputs.tail]]
files = ["/test.log"]
watch_method = "poll"
data_format = "json"
name_override = "test-key"
tag_keys = ["first"]
json_query = "friends"
System info:
Telegraf v 1.11.2
OS: Debian 9
Steps to reproduce:
- Follow the example for JSON Query -
https://github.com/influxdata/telegraf/tree/master/plugins/parsers/json#query
So a sample entry in the file would be -
{"friends": [{"first": "Dale", "last": "Murphy", "age": 44},{"first": "Roger", "last": "Craig", "age": 68},{"first": "Jane", "last": "Murphy", "age": 47}]}
Expected behavior:
All entries in the array are parsed (very similar to the posted example)
{"fields":{"age":44},"name":"test-key","tags":{"first":"Dale","host":"test-us1-instance","path":"/test.log"},"timestamp":1563466236}
{"fields":{"age":68},"name":"test-key","tags":{"first":"Roger","host":"test-us1-instance","path":"/test.log"},"timestamp":1563466236}
{"fields":{"age":47},"name":"test-key","tags":{"first":"Jane","host":"test-us1-instance","path":"/test.log"},"timestamp":1563466236}
Actual behavior:
Only the first array entry is being parsed.
{"fields":{"age":44},"name":"test-key","tags":{"first":"Dale","host":"test-us1-instance","path":"/test.log"},"timestamp":1563466236}