'Setting the table name in telegraf mqtt_consumer plugin
I am using telegraf to write mqtt messages to questdb. Currently, all my mqtt messages are written into the table "mqtt_consumer" by default. How can I change the name, where the mqtt_consumer is writing the data into the db?
[inputs.mqtt_consumer.tags]
destinationdb = "mqtt_data"
That doesn't work. I cant find an option for that. It could be that the table name needs to be set in the output plugin but I can't find any option for that. This is my output plugin:
[[outputs.socket_writer]]
adress = "tcp://localhost:9000"
Solution 1:[1]
I believe questdb uses the metric name to determine what table it writes to. The metric name is determined by the input name in most cases.
You can rename a metric via:
[[processors.rename]]
[[processors.rename.replace]]
measurement = "mqtt_consumer"
dest = "mqtt_data"
Edit:
I forgot about the name_override option. You can use that to change the name of the measurement directly. See it listed in the configuration options docs. You could set this for every mqtt_consumer input plugin to get distinct measurement names.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
