Telegraf parsing with regex

Hi, I am new to telegraf. I am reading data from an MQTT server, which posts data in json format. The next step I need is to parse the field data using a regex. My problem is that I am unable to debug the configuration I am using. I don’t understand how I am supposed to “catch” a string in json and parse it.

The [[processors.printer]] processor doesn’t show me the fields, but only a set of numbers.

[[inputs.mqtt_consumer]]
  servers = ["tcp://SERVER:1883"]
  qos = 0
  connection_timeout = "30s"
  topics = [
    "#"
  ]
  data_format = "json"
  # data_format = "influx"
  tag_keys = [
    "data"
  ]

[[processors.regex]]
  tagpass = ["*data*"]

  [[processors.regex.fields]]
    key = "data"
    pattern = "(.*)"
    replacement = "${1}"
    result_key = "test"

[[processors.printer]]

[[outputs.influxdb]]
  urls = ["http://influxdb:8086"]

What am I doing wrong?

The printer processor had a bug which was fixed in 1.7.2, if you upgrade it should be working again. For the regex processor question, can you show me an example of what your input data looks like and how you would like the output data to look?

Thank you Daniel, I have a json coming from mqtt which has a field “data”. This field is a set of variables with a value assigned, separated by a special character (e.g. “|”, “&”): “a=2|b=33.4|c=44.554”. I created the regex for this: “(?P\w*)=(?P[\w.]*)”.

I am understandig a little bit more about influxdb concepts. What I desire to achieve is that each variable in the string becomes a field of a table.

[[processors.regex.fields]]
    key = "data"
    pattern = "(?P<field>\\w*)=(?P<value>[\\w.]*)"
    replacement = "${2}"
    result_key = "${1}"

Is that correct?

So the incoming data would contain:

{"data": "a=2|b=33.4|c=44.554"}

And the desired output would be something along the lines of:

foo a=2,b=33.4,c=44.554

I assume this data could have an arbitrary number of key/value pairs?