Hi,
I’m using Telegraf with the MQTT-Input-Plugin to write data to an InfluxDB.
I’m parsing the input from the MQTT-source as JSON.
Here is a part of my configuration conf-file:
[[inputs.mqtt_consumer.json_v2]]
[[inputs.mqtt_consumer.json_v2.tag]]
path = "deviceName"
[[inputs.mqtt_consumer.json_v2.tag]]
path = "devEUI"
[[inputs.mqtt_consumer.json_v2.tag]]
path = "tags.location"
[[inputs.mqtt_consumer.json_v2.tag]]
path = "tags.municipality"
[[inputs.mqtt_consumer.json_v2.tag]]
path = "tags.sensortype"
The tags “tags.location”, “tags.municipality” and “tags.sensortype” in the source data are in the end from manual inputs when registering sensors. So they might be missing, when some forget to put in a value. Still the sensors will send data that I want to write into the database.
But Telegraf dismisses the complete data set, when one of the configured tags is missing.
Is there a way to force Telegraf to still write the data, though one of the tags is missing?
Would be fine for me to write the missing tag as “” or “null” or whatever.