How does telegraf perform this conversion?

35 Views Asked by At

I am using telegraf to receive the collected data from mqtt.

The data received is in json format:

{
  "version": 2.1,
  "information": {
    "adsid":"COTXJJSZC0101",
    "meterid": "METKTZYDAK101",
    "Address": "1",
    "com": "com1",
    "data": [
      {
        "Tagname": "2759-A-1O-METKTZYDAK101-EPAD0CC",
        "quality": 0,
        "value": 67378.201,
        "Time": "2022-11-01 17:17:45"
      },
      {
        "Tagname": "2759-A-1O-METKTZYDAK101-IA000CC",
        "quality": 0,
        "value": 5.200,
        "Time": "2022-11-01 17:17:45"
      }
    ]
  }
}

I want to convert it to line protocolcompliant format:

metktzydak101,epad0cc=67378.201,ia000cc=5.200 1667323065

I don't quite understand how to merge multiple lines into one in this process I'm a beginner and would love your help.Thank You!

0

There are 0 best solutions below