Hi,
I am trying to parse json array from telegraf to influxdb, the source of the json data is NATS server. below is the sample data.
[{“runId”:“R001”,“testName”:“Test”,“nodeName”:“Test-Node”,“errorMessage”:“noData”,“errorResponseBody”:“noData”,“requestName”:“WebSocket Open Connection-1”,“responseCode”:“Websocket I/O error”,“result”:“fail”,“samplerType”:“transaction”,“connectTime”:0,“count”:1,“errorCount”:1,“latency”:0,“processingTime”:0,“receivedBytes”:0,“sentBytes”:0,“responseTime”:81,“timeStamp”:1727323776272,“time”:1727323776352000000,“ObjectType”:“requestsRaw”}, {“runId”:“R001”,“testName”:“Test”,“nodeName”:“Test-Node”,“errorMessage”:“noData”,“errorResponseBody”:“noData”,“requestName”:“WebSocket Open Connection-1”,“responseCode”:“Websocket I/O error”,“result”:“fail”,“samplerType”:“transaction”,“connectTime”:0,“count”:1,“errorCount”:1,“latency”:0,“processingTime”:0,“receivedBytes”:0,“sentBytes”:0,“responseTime”:80,“timeStamp”:1727323776353,“time”:1727323776433000000,“ObjectType”:“requestsRaw”}]
I tried multiple configurations, lastly i used is
[[inputs.nats_consumer]]
servers = [“nats://localhost:4222”]
subjects = [“nats.subject.requestsraw”]
data_format = “json_v2”
[[inputs.nats_consumer.json_v2]]
[[inputs.nats_consumer.json_v2.object]]
path = “@this”
disable_prepend_keys = true
tags = [“runId”, “testName”, “nodeName”, “ObjectType”]