I’m trying to get a json array inside my influxdb using telegraf. But have a problem to get the right time_format.
telegraf.conf:
[[inputs.file]]
files = ["observations-export.json"]
data_format = "json"
json_query = "report"
json_time_key = "time"
json_time_format = "2006-01-02T15:04:05+02:00"
observation-export.json:
{
"report": [
{
"windspeed": 8,
"windgust": 13,
"winddirection": 116,
"time": "2019-04-01T12:40:00+02:00"
},
{
"windspeed": 10,
"windgust": 15,
"winddirection": 96,
"time": "2019-04-01T12:50:00+02:00"
},
{
"windspeed": 10,
"windgust": 15,
"winddirection": 110,
"time": "2019-04-01T13:00:00+02:00"
},
{
"windspeed": 10,
"windgust": 13,
"winddirection": 121,
"time": "2019-04-01T13:10:00+02:00"
}
]
}
When doing a test run with telegraf this is the output:
> file,host=server winddirection=116,windgust=13,windspeed=8 1554208800000000000
> file,host=server winddirection=96,windgust=15,windspeed=10 1554209400000000000
> file,host=server winddirection=110,windgust=15,windspeed=10 1554210000000000000
> file,host=server winddirection=121,windgust=13,windspeed=10 1554210600000000000
This is not the right epoch i think? So there is someting wrong changing from the time format to epoch.