Telegraf inputs.file JSON failure

Hi I’m trying to parse the following json file to influxdb via telegraf using the inputs.file config. I’m getting 2019-12-23T03:36:50Z E! [inputs.file] Error in plugin: JSON time key could not be found

Below are my json file & telegraf config.

JSON File content

{
“value”: [
{
“currentScore”: 203.0,
“maxScore”: 802.0,
“createdDateTime”: “2019-12-18T00:00:00Z”
},
{
“currentScore”: 203.0,
“maxScore”: 802.0,
“createdDateTime”: “2019-12-17T00:00:00Z”
}
]
}

Telegraf.conf

[[inputs.file]]
json_name_key = “score”
data_format = “json”
files = ["/opt/influxdb/getscore.json"]
json_time_key = “createdDateTime”
json_time_format = “2019-12-18T00:00:00Z”

Try adding json_query = "value".

1 Like