Hi,
I am using the JSONv2 parser in Telegraf to process Kafka consumer input. My input JSON is an array with the following structure:
[
{
“sensorData”: {
“deviceId”: “123456”,
“pressureInfo”: {
“absolutePressure”: 1013.25,
“temperature”: 25
}
}
}
]
I want the parser to handle this JSON and produce the following output in InfluxDB:
- Add
deviceId(fromsensorData.deviceId) as a tag with the keydevice_id. - Add the entire
sensorDataobject as a field with the keysensor_data, stored as a string. - Add the
absolutePressurevalue (fromsensorData.pressureInfo.absolutePressure) as a field with the keyabsolute_pressure.
Desired Output in InfluxDB:
Tag: device_id = “123456”
Field: sensor_data = {"deviceId":"123456","pressureInfo":{"absolutePressure":1013.25,"temperature":25}}
Field: absolute_pressure = 1013.25
Could you please guide me on how to configure the JSONv2 parser to achieve this output?
