Skip to content

Commit

Permalink
Convert ignoredStreamKeys to a map
Browse files Browse the repository at this point in the history
  • Loading branch information
fingon committed Oct 31, 2024
1 parent ba3d6ab commit eaac8a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion data/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ package data
// When adding rules, these stream keys are NOT included
//
// (This doesn't prevent their manual addition)
var ignoredStreamKeys = []string{"host", "lixie"}
var ignoredStreamKeys = map[string]bool{"host": true, "lixie": true}
7 changes: 2 additions & 5 deletions data/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,14 @@ func (self *Database) ClassifyHash(hash uint64, ham bool) error {
Value: l.Message,
}}}
for _, k := range l.StreamKeys {
for _, ignoredStream := range ignoredStreamKeys {
if ignoredStream == k {
goto next
}
if ignoredStreamKeys[k] {
continue
}
rule.Matchers = append(rule.Matchers, LogFieldMatcher{
Field: k,
Op: "=",
Value: l.Stream[k],
})
next:
}
return self.Add(rule)
}
Expand Down

0 comments on commit eaac8a3

Please sign in to comment.