I would like to parse the following JSON with Telegraf into InfluxDB using json_v2. The JSON contains datetime information, but I cannot figure out how to set up the telegraf configuration to make the datetime information to be picked up.
I followed the examples on https://www.influxdata.com/blog/how-parse-json-telegraf-influxdb-cloud/
Here a snippet of my JSON. You can find the typical full JSON output here: https://gist.githubusercontent.com/anjoweichbrodt/69507cc5e93e0194aa92843863596340/raw/cbaaa3e0ec812638d46cb79d4b9654a76ae3eed6/json_output
[
{
"Caption": "mote temperature",
"Mote": "0x70",
"dt": 1598019166,
"Value": 24.06,
"Unit": "°C",
"SensorID": "1339399",
"Heading": "SM_TEMP (Temperature)"
},
{
"Caption": "operating T",
"Mote": "0x70",
"dt": 1598009240,
"Value": -325.79,
"Unit": "°C",
"SensorID": "1339527",
"Heading": "SM_TEMP (Temperature)"
},
{
"Caption": "mote temperature",
"Mote": "0x72",
"dt": 1597085475,
"Value": 23.06,
"Unit": "°C",
"SensorID": "1339911",
"Heading": "SM_TEMP (Temperature)"
}
]
Following my telegraf configuration:
[[inputs.http]]
urls = ["http://flask-app:5000/"]
tagexclude = ["url", "host"]
data_format = "json_v2"
[[inputs.http.json_v2]]
[[inputs.http.json_v2.object]]
path = "#.@this"
tags = ["Mote","Heading","SensorID","Caption"]
timestamp_key = "dt"
timestamp_format = "unix"
