How to preprocess json_v2 with one timestamp for an array of values

Hello,

I am running into problem processing our internal json data with telegraf and influxdb.
The data package looks the following:
{
“meta”: {
“sensor”: “VoltageL1”,
“normalized”: true,
“unit”: “V”,
“range”: 1000,
“maximum”: 1.0,
“sampletime”: 10000,
“numVal”: 1000
},
“starttime”: 133312145513450000,
“values”: [
229.692,
229.692,
229.692,

(truncated for brevity)

229.761,
229.761,
229.761,
229.761,
229.761
]
}
Is it possible to directly preprocess the timestamp with the given sampletime (1ms increment) in telegraf to save with the following format to influxdb
{“starttime”: 133312145513450000, “value”: 229.761},
{“starttime”: 133312145513450000, “value”: 229.761}, …

How would the resulting mqtt_consumer look like?
Thanks for any help in advance.

133312145513450000

This is 18-digits long. A typical nanosecond timestamp is 19-digits. It is probably not what you want. The current millisecond timestamp is 1686773738629, or 13-digits.

In any case, when you parse your JSON you can need to:

  1. Set the precision of the agent or the input to ms
  2. If parsing the JSON use the json_time_format = "unix_ms" option