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
{
"timestamp":1656879450,
"mytag":"something to tag",
"data":
[
{"sensor_id":1, "outside_temp": 10},
{"sensor_id":2, "inside_temp": 20}
]
}
and my telegraf config
# Telegraf 1.23.0
[[inputs.file]]
files = ["./test.json"]
data_format = "json_v2"
[[inputs.file.json_v2]]
measurement_name = "Weather"
timestamp_path = "timestamp"
timestamp_format = "unix"
[[inputs.file.json_v2.object]]
path = "data"
tags = ["sensor_id"]
[[processors.enum]]
[[processors.enum.mapping]]
tag = "sensor_id"
# dest = "sensor_name"
[processors.enum.mapping.value_mappings]
"Sensor X" = 1
"Sensor Y" = 2
console output
> Weather,sensor_id=1 outside_temp=10 1656879450000000000
> Weather,sensor_id=2 inside_temp=20 1656879450000000000