I've been struggling already for few days to get this one working. All the solutions that I found from people with same problem did not work for me.
I am parsing data from JSON file through Telegraf using [inputs.file] and using this data later on in Grafana from InfluxDB.
My problem: All key-value pairs where value is in a form of a number are working as they should and are showing correctly in InfluxDB. However, all key-value pairs where value is a string or boolean are not working.
Part of my json:
},
"electricChargingState": {
"chargingConnectionType": "UNKNOWN",
"chargingLevelPercent": 77,
"chargingStatus": "CHARGING",
"chargingTarget": 100,
"isChargerConnected": true,
"range": 205
From the above code I am getting "charginLevelPercent", "chargingTarget" and "range", I cannot get "ChargingStatus" and "isChargerConnected".
In telegraf [inputs.file] I tried, but without success:
json_string_fields = ["chargingStatus"]
Also, in [processors.converter] I tried, but without success:
[[processors.converter]]
[processors.converter.tags]
string = ["chargingStatus*"]
boolean = ["isChargerConnected"]
[processors.converter.fields]
tag = ["chargingStatus"]
string = ["chargingStatus"]
boolean = ["isChargerConnected"]
Thanks to everyone who spare some of their valuable time to help me find solution.
problem has been solved by using the underscores and in json_string_fields declare full path of the key-value pair. Hope this sort problem for someone else as well. For instance:
json_string_fields = ["state_electricChargingState_isChargerConnected"]