MQTT json transformation extract fields

hi all, i have this json, as an example, coming from telegraf to influxdb

{
  "documents": {
    "15037": {
      "document": {
        "entry": "01IT-796-2024.xml",
        "fields": {
          "eDocStatus": "RC",
          "isFPA": false,
          "eRemappedDocStatus": "SENT",
          "docType": "invoices",
          "idSDI": "12182393867"
        },
        "date": 1716484831
      }
    }
  }
}

i can use transformation → extract fields if a put something like
documents.15037.document.entry

the problem is that 15037 is a progressive number so i need to put a wildcard like
documents.*.document
of course this is not working as “Field” does not seem to accept any kind of regex or wildcard

is there any solution/workaround?
thanks

Manuel

Grafana v10.2.3 / openSUSE Leap 15.4

welcome @ManuelDTL

why are you writing your json data to influxdb and not extract the data and write it to proper fields etc instead of dumping the json as is into influxdb.

are you using flux query language or influxql? you are better off using the datasource language to extract the data as show here.

Hi yosiasz, thanks for the reply, I’m using telegraf to collect data, telegraf plugin,mqtt_consumer, is responsible for collecting data from mosquitto to influxdb, I’m not using any “manual” queries, I don’t know Influx, i’m only able to use the grafana gui, if there is no other way i can take a look at that and learn some new stuff.
thanks again
Manuel

1 Like

purely grafana transformation is going to be pretty impossible imo