Skip to content

Commit

Permalink
Fixed tags filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
tsvtitan committed Oct 20, 2023
1 parent 7937355 commit 5b59e43
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins/processors/filter/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,19 @@ func (f *Filter) ifCondition(item *FilterIf, metric telegraf.Metric) bool {
keys := f.getKeys(tags)

flag := true
for k, r := range item.tags {
for k, v := range item.Tags {

if !utils.Contains(keys, k) {
continue
return false
}

exists := false
value := tags[k]
r := item.tags[k]
if r != nil {
exists = r.MatchString(value)
} else {
exists = value == item.Tags[k]
exists = value == v
}

flag = flag && exists
Expand Down

0 comments on commit 5b59e43

Please sign in to comment.