[Telegraf] ConfigMap telegraf Yaml => Toml error
lpaulusLohr opened this issue ยท 10 comments
Hi,
I have an problem with ConfigMap Yaml to Toml parsing :
I want this :
[[inputs.mqtt_consumer.json_v2.object]]
path = "@this"
tags = ["device","data.type","owner"]
But the helm parsing template render it like :
[[inputs.mqtt_consumer.json_v2.object]]
path = "@this"
tags = "[device data.type owner]"
My Yaml :
object:
path: "@this"
tags:
- "device"
- "data.type"
- "owner"
I found the problem is here in the template _helpers.tpl l.277
[inputs.{{ $input }}.{{ $key }}.{{ $k }}]
{{- range $foo, $bar := $v }}
{{ $foo }} = {{ $bar | quote }}
Could you please try the latest chart with --set tplVersion=2
.
Ok working as expect
Thanks for making generalization on child Inputs !
Result :
[inputs.mqtt_consumer.json_v2]
measurement_name_path = "device"
[inputs.mqtt_consumer.json_v2.object]
path = "@this"
tags = [
"device",
"data.type",
"owner"
]
Should be
[[inputs.mqtt_consumer.json_v2]]
measurement_name_path = "device"
[[inputs.mqtt_consumer.json_v2.object]]
path = "@this"
tags = [
"device",
"data.type",
"owner"
]
for
json_v2:
- measurement_name_path: "device"
object:
- path: "@this"
tags:
- "device"
- "data.type"
- "owner"
It's a Match ๐ : @lupaulus
json_v2:
measurement_name_path: "device"
object:
path: "@this"
tags:
- "device"
- "data.type"
- "owner"
I see :)
OK to close the issue?
@alespour I did not pay attention, but there is a problem on the title of the "section", there is only 1 hook instead of 2
[[inputs.mqtt_consumer]]
data_format = "json_v2"
topics = [
"XXXX"
]
[inputs.mqtt_consumer.json_v2]
measurement_name_path = "device"
[inputs.mqtt_consumer.json_v2.object]
path = "@this"
tags = [
"device",
"data.type",
"owner"
]
Two hooks are rendered when entries are lists. In your config there are only dictionaries, so 1 hook is correct.
In config shown in my comment json_v2
and object
are lists, so there are 2 hooks rendered around the title of the section.
This is my config, check if I'm wrong but I use lists :
EDIT : I'm wrong...
- mqtt_consumer:
topics:
- "XXXX"
data_format: "json_v2"
json_v2:
measurement_name_path: "device"
object:
path: "@this"
tags:
- "device"
- "data.type"
- "owner"
Sorry
no problem ๐