tags no longer required in included_keys (#9406)

This commit is contained in:
Mya 2021-06-22 10:48:29 -06:00 committed by GitHub
parent ac9bf5a0ec
commit 8638a41724
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -484,6 +484,8 @@ func (p *Parser) isIncluded(key string, val gjson.Result) bool {
if len(p.currentSettings.IncludedKeys) == 0 { if len(p.currentSettings.IncludedKeys) == 0 {
return true 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 { for _, i := range p.currentSettings.IncludedKeys {
if i == key { if i == key {
return true return true

View File

@ -9,10 +9,8 @@ data_format = "json_v2"
disable_prepend_keys = true disable_prepend_keys = true
path = "@this" path = "@this"
included_keys = [ included_keys = [
"hostname",
"systemVoltage", "systemVoltage",
"systemCurrent", "systemCurrent",
"tables", "tables",
"tables_outputname",
] ]
tags = ["hostname", "tables_outputname"] tags = ["hostname", "tables_outputname"]

View File

@ -6,7 +6,7 @@
[[inputs.file.json_v2.object]] [[inputs.file.json_v2.object]]
path = "root.station" path = "root.station"
disable_prepend_keys = true disable_prepend_keys = true
included_keys = ["name", "etd_destination", "etd_estimate_minutes"] included_keys = ["etd_estimate_minutes"]
tags = ["name", "etd_destination"] tags = ["name", "etd_destination"]
[inputs.file.json_v2.object.fields] [inputs.file.json_v2.object.fields]
etd_estimate_minutes = "int" etd_estimate_minutes = "int"