Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersonQ committed Jun 12, 2024
1 parent 328670b commit 4d2f713
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions libbeat/reader/filter/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,22 @@ func NewParser(r reader.Reader, c *Config) *FilterParser {
}
}

func (p *FilterParser) Next() (reader.Message, error) {
func (p *FilterParser) Next() (message reader.Message, err error) {
// discardedOffset accounts for the bytes of discarded messages
var discardedOffset int
defer func() {
message.Bytes += discardedOffset
}()

for p.ctx.Err() == nil {
message, err := p.r.Next()
message, err = p.r.Next()
if err != nil {
return message, err
}
if p.matchAny(string(message.Content)) {
return message, err
}
discardedOffset += message.Bytes
p.logger.Debug("dropping message because it does not match any of the provided patterns [%v]: %s", p.matchers, string(message.Content))
}
return reader.Message{}, io.EOF
Expand Down

0 comments on commit 4d2f713

Please sign in to comment.