Wild card or regex in Topic name in MQTT broker

I am using InfluxDB 2.0.4 and Teleraf 1.22.1 for reading the from MQTT broker.
I am getting multiple device data in my broker. For one device it creates the one topic.
Now no of the topics getting increased now I want to wild card in the topic name so when new devices come I don’t have to add a topic name in Telegraf configuration

suppose I have topic name below

topics = [

I want to pass something like topics = [


Something like that so I don’t have to update the config when a new device comes.

@Jay_Clifford Can you help me here please?

Hi @Ravikant_Gautam,
To pull all topics and topic layers you can use the following notation:

topics = [

This would be subscribing to all topics from your MQTT broker. It is not best practice to subscribe to the root layer. Instead, I would like to set up your device topics like so:


Then you can do:


I highly recommend checking out this awsome blog from HiveMQ: MQTT Topics & Best Practices - MQTT Essentials: Part 5

1 Like