I can’t figure out how to parse my MQTT topic into tags. My topic looks like this: tele/seattle/conf1/bme280/SENSOR
.
My attempt to extract the fields into tags:
[[inputs.mqtt_consumer.topic_parsing]]
tags = "_/site/room/sensor/_"
The error when I test:
[telegraf] Error running agent: Error loading config file /etc/telegraf/telegraf.conf: plugin inputs.mqtt_consumer: line 31: configuration specified the fields ["topic_parsing"], but they weren't used
Hey. Which version are you using? Topic parsing is only available in 1.21+. Furthermore, you are missing the topic
field in the topic_parsing
section. This field is required to determine which topics should be parsed with the given values (kind of a filter).
Given your example you probably want
[[inputs.mqtt_consumer.topic_parsing]]
topic = "tele/+/+/+/#"
tags = "_/site/room/sensor/_"
3 Likes
Thanks @srebhan. I was confused about the topic
value and that clears it up and I was on 1.19.x
. Working now!
1 Like