Converting fieldkey into field value or tag value

Hi I am new and I hope I can get assistance.

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.

Hi @scott - Thank you for your response.

I am getting the data from my MQTT broker and below is the config I have which is the only place I define how the JSON payload is parsed:

Read metrics from MQTT topic(s)

servers = [“tcp://”]
topics = [

topic_tag = “”
qos = 1
connection_timeout = “30s”
persistent_session = true
client_id = “telegraf”
username = “my_user”
password = “my_password”
data_format = “json”
json_name_key = “nodeId”
json_time_key = “readTimestamp”
json_time_format = “2006-01-02T15:04:05Z07:00”
tag_keys = [


Convert values to another metric value type

order = 1
measurement = [“nodeId”]
#tag =
#string =
#integer =
#unsigned =
#boolean =
#float =

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

Thank you @scott for the guidance.

I will implement this and provide feedback once I figure it out.

Sorted! Thanks @scott .