Data overwritting issue with Telegraf MQTT in InfluxDB

27 Views Asked by At

Telegraf MQTT plugin in InfluxDB is overwriting data with same _field.

I am recieving the following input data via Telegraf MQTT in InfluxDB [[inputs.mqtt_consumer]]. The issue I am facing is that MQTT is overwriting the Latitude and Longitude values. Instead of displaying all three object values in InfluxDB. I can only see last object value and rest are overwritten.

Input data:

[
{“Latitude”:48.8108060, “Longitude”:13.5473266},
{“Latitude”:48.8103460, “Longitude”:13.5481769},
{“Latitude”:48.8070218, “Longitude”:13.5567778}
]

To address the above issue I want to process the incoming data and convert the input data to the processed data below:

[
{“wp1”: {“Latitude”:48.8108060, “Longitude”:13.5473266}},
{“wp2”:{“Latitude”:48.8103460, “Longitude”:13.5481769}},
{“wp3”:{“Latitude”:48.8070218, “Longitude”:13.5567778}}
]

With the above processed data I can see all three JSON objects in the database as the _field is different.

How can I achieve this task?

0

There are 0 best solutions below