I tried sending Line Protocol to a single MQTT topic, using the data_format = "influx"
setting for [[inputs.mqtt_consumer]]
and it does work, but I did notice that the “measurement” part of the Line Protocol seems to be ignored, such that all tags and fields end up under the single “mqtt_consumer” measurement. However by filtering on publisher-supplied tags (rather than MQTT topics with the “value” method) I’m able to extract the right data, as string or float as needed, if I tag it sensibly.
It does feel a bit like an extra hoop to jump through though, and it does mean any other MQTT subscribers (like a mobile app or websocket app) don’t see nice per-topic values coming in, as everything arrives via a single topic. I’ll do some more testing and consider it as a possible solution though.
It’s a shame that the measurement name isn’t used by Telegraf when sending the data to InfluxDB. That would have been a really nice solution to another problem I have where everything via MQTT ends up in one “mqtt_consumer” measurement and certain operations are not possible unless they are split between measurements. The workaround for that is currently multiple instances of the mqtt_consumer input plugin, with name_override
to set each measurement’s name.