Skip to content

Commit

Permalink
tags no longer required in included_keys (#9406)
Browse files Browse the repository at this point in the history
  • Loading branch information
MyaLongmire authored Jun 22, 2021
1 parent ac9bf5a commit 8638a41
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions plugins/parsers/json_v2/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ func (p *Parser) isIncluded(key string, val gjson.Result) bool {
if len(p.currentSettings.IncludedKeys) == 0 {
return true
}
// automatically adds tags to included_keys so it does NOT have to be repeated in the config
p.currentSettings.IncludedKeys = append(p.currentSettings.IncludedKeys, p.currentSettings.Tags...)
for _, i := range p.currentSettings.IncludedKeys {
if i == key {
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ data_format = "json_v2"
disable_prepend_keys = true
path = "@this"
included_keys = [
"hostname",
"systemVoltage",
"systemCurrent",
"tables",
"tables_outputname",
]
tags = ["hostname", "tables_outputname"]
2 changes: 1 addition & 1 deletion plugins/parsers/json_v2/testdata/object/telegraf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[[inputs.file.json_v2.object]]
path = "root.station"
disable_prepend_keys = true
included_keys = ["name", "etd_destination", "etd_estimate_minutes"]
included_keys = ["etd_estimate_minutes"]
tags = ["name", "etd_destination"]
[inputs.file.json_v2.object.fields]
etd_estimate_minutes = "int"

0 comments on commit 8638a41

Please sign in to comment.