i am reading data from a microcontroller
home/room/workshop/temperature1 20.36
home/room/workshop/humidity 46.36
home/room/workshop/pressure 996.27
home/room/workshop/temperature2 16.94
i read in this data with telegraf
telegraf.conf
…
[[inputs.mqtt_consumer]]
…
topics = [
“home/+/+/+”,
]
…
data_format = “value”
data_type = “float”
my problem is now, the issue of topic=… since this is also written to the database
A solution is to leave out the topic area [[inputs.mqtt_consumer.topic_parsing]], but then telegraf no longer starts.
2023-03-14T17:53:25Z E! [telegraf] Error running agent: could not initialize input inputs.mqtt_consumer: config error topic parsing: measurement length does not equal topic length
the database entry
Table: keys: [_start, _stop, _field, _measurement, location1, location2, topic]
_start:time _stop:time _field:string _measurement:string location1:string location2:string topic:string _time:time _value:float
2023-03-14T17:27:59.732326779Z 2023-03-14T17:57:59.732326779Z temperature1 home room workshop home/room/workshop/temperature1 2023-03-14T17:31:18.550720212Z 20.19
I don’t know how I don’t get this entry topic= transferred to the database
Tanks
Hi,
I don’t understand the hint.
My topic from controller is:
home/room/workshop/temperature1 23.02
home/room/workshop/humidity 37.63
home/room/workshop/pressure 1012.33
home/room/workshop/temperature2 19.06
I have four entries
home measurement
room location1
workshop location2
temperature1 field
@Heinz the topic takes up exactly one time the byte size of the topic text for InfluxDB, but you can get rid of it using metric modifiers more specifically tagexclude.
now the topic is no longer stored in the database.
_start:time _stop:time _field:string _measurement:string location1:string location2:string _time:time _value:float
2023-04-12T08:27:32.087611861Z temperature2 home room workshop 2023-04-12T08:28:11.393511938Z 10.69
2023-04-12T08:27:32.087611861Z temperature2 home room workshop 2023-04-12T08:29:11.396965350Z 10.75
I don’t know if it’s the best solution, but this is how it works