I have set up a TIG stack and telegraf consumes a JSON payload that is an array:
“nodeId”: 27131,
“readings”: [
{
“frequencyHertz”: 2995.034,
“channel”: 0,
“thermistorOhms”: 3295.461,
“frequencyDigits”: 8970.228661156,
“engineeringValue”: 2.301,
“engineeringUnit”: “kPa”,
“temperatureDegrees”: 22.8
}
I am interested in the engineering value as a field with the channel and channel value as a tag key and tag value. However this is proving very difficult and I am not able to find an example or guidance.
The data is parsed into InfluxDB where the field key is “readings_0_engineeringValue”, and I was wondering if there is a way I can take this field key and convert it to a tag value and manipulate it in one of the processor plugs to extract the channel number in this case “0”.
@Winston_Nxumalo Can you provide your JSON parser config. I think you can structure the data how you want on ingest rather than having to restructure it at query time.
Yeah, you should leverage the json_v2 parser with the mqtt_consumer input to parse the message into the exact schema you want. Here’s a blog post that covers how to do it: MQTT Topic and Payload Parsing with Telegraf | InfluxData