Parsing json array of strings with json_v2.object produces an error

louisn
Thu, 13 Feb 2025 15:14:11 +0000
Telegraf

For a very simple input as shown (apologies for the message string internal formatting but it is what it is and should be seen as a string from the parsing perspective.)

 {
   "uptimeSeconds": 441402.94,
   "status": 2,
   "messages": [
     "[Alarm 0] Error - Weather data not available",
     "[Alarm 1] Error - 3 configured nodes have not reported SoftwareInfo: [adam,meanwell,eltek]",
     "[Alarm 2] Warning - 6 configured nodes have old or missing heartbeats: exeltech,linovision,adam,vertiv,meanwell,eltek]",
     "[Alarm 3] Error - Battery info not available",
     "[Alarm 4] Error - Generator info not available",
     "[Alarm 5] Warning - Generator taking too long to stop"
   ]
}

The object configuration should parse the array according to the documentation but fails to do so.

[[inputs.kinesis_consumer.json_v2]]

    [[inputs.kinesis_consumer.json_v2.object]]
	  path = "messages"
	  disable_prepend_keys = true
	  tags = ["messages"]
	  optional = true

The error log shows this output -

2025-02-13T15:04:16Z D! [serializers.influx] could not serialize field "": invalid field key; discarding field

I am referencing this documentation - JSON v2 input data format | Telegraf Documentation

1 post - 1 participant