Telegraf config - getting substrings and converting hexadecimal to int

Processors work on all plugins unless you specify a tag or metric name to pass into them. They also run after an input plugin is run, so passing them the gjson syntax is not something they will recognize.

If I run only your one input I get a single metric:

a,dmac=BC57290123B5,gmac=94A408B02508,host=ryzen rssi=-44,data1="0201060DFF530ABC57290123B51A5A0C63" 1666101895000000000

I believe your next step is to parse data1 to get chars 13-14 and 15-16 and then convert them from hexadecimal to integer values?

I would do something like the following:

  namepass = ["a"]

  source = '''
def apply(metric):
  data1 = metric.fields.pop('data1')
  metric.fields["data_13"] = int("0x" + data1[13:15], 0)
  metric.fields["data_15"] = int("0x" + data1[15:17], 0)
  return metric

This is a starlark processor that grabs only metrics called “a”, rips out the data1 field, and converts some strings parts from hex to an int and saves them to the metric.

Give that a try!