Reputation: 1187
I have an influxdb, telegraf and Chronograf stack running and it is showing data coming from an MQTT broker. The data comes in JSON format and looks similar to this:
{
"msgid": "id1",
"senderid": "id2",
"measures": [
{
"type": "O",
"value": "value1"
},
{
"type": "CO2",
"value": "value2"
}
]
}
To be able to analyze the different values I need telegraf to load the type and value strings. I have defined the json_string_fields
like this:
json_string_fields = ["msgid","senderid","measures_0_type","measures_1_type","measures_0_value","measures_1_value"]
This way I can perform queries over the data but it is limited to the first two measures. Is there any way to define all the ocurrences of the array? Some kind of wildcard?
Upvotes: 1
Views: 2845
Reputation: 2890
To use wildcards for json_string_fields you can do like for example:
json_string_fields = ["msgid","senderid","measures_?_type","measures_?_value"]
So if they go from 0 to 1000, you will get them all!
Upvotes: 4