Processors.enum not working?

Hi All,

Just started with InfluxDB, for collecting sensor data.

I can’t get the [[processors.enum]] to work. I tried other processors (like [[processors.defaults]] ) they work fine.

My goal is to have the ```sensor_id`` being replaced with a tag that would name the sensor. I tried with field and tag and also with and without dest. It looks like it should be pretty straight forward, but nothing seems to work.

Any help appreciated

Below my test files.

input file

    "mytag":"something to tag",
        {"sensor_id":1, "outside_temp": 10},
        {"sensor_id":2, "inside_temp": 20}        

and my telegraf config

# Telegraf 1.23.0
    files = ["./test.json"]
    data_format = "json_v2"

        measurement_name = "Weather"   
        timestamp_path = "timestamp"
        timestamp_format = "unix"
            path = "data"
            tags = ["sensor_id"]     

            tag = "sensor_id"
            # dest = "sensor_name"
                "Sensor X" = 1
                "Sensor Y" = 2

console output

> Weather,sensor_id=1 outside_temp=10 1656879450000000000
> Weather,sensor_id=2 inside_temp=20 1656879450000000000

You got it in reverse. Try this:

            tag = "sensor_id"
            # dest = "sensor_name"
                1 = "Sensor X"
                2 = "Sensor Y"

Awesome, thanks! (silly me).

Beat me to it @Hipska.

Here is your example @16r: Telegraf-Community-Configs/telegraf-jsonv2-enum.conf at master · InfluxCommunity/Telegraf-Community-Configs · GitHub

I took it from the enum, here:

There is has <label =

Thanks for the quick help!

The readme is correct. They convert a label to an integer value.

You are doing the opposite, so the config should also be the opposite :wink:

1 Like