Skip to content

Commit 272d2fa

Browse files
committed
fix(agent): filter false events lost from go-libaudit sequence rollover
1 parent 6cb6c41 commit 272d2fa

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

agent/collector/auditd/stream.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ import (
1212

1313
const (
1414
// eventsLostThreshold - only log when this many events are lost at once.
15+
// Small losses (1-10) are normal under high load and not worth logging.
1516
eventsLostThreshold = 50
17+
18+
// eventsLostMaxReasonable is the maximum "reasonable" number of lost events.
19+
eventsLostMaxReasonable = 1000000
1620
)
1721

1822
// eventStream implements libaudit.Stream interface for reassembled events
@@ -59,10 +63,12 @@ func (s *eventStream) ReassemblyComplete(msgs []*auparse.AuditMessage) {
5963
}
6064
}
6165

62-
// EventsLost is called when events were lost due to buffer overflow
66+
// EventsLost is called when events were lost due to buffer overflow or rate limiting.
67+
// We filter these out by checking against a reasonable maximum.
6368
func (s *eventStream) EventsLost(count int) {
64-
if count < eventsLostThreshold {
69+
// Filter out unreasonable values caused by sequence number rollover bug
70+
if count < eventsLostThreshold || count > eventsLostMaxReasonable {
6571
return
6672
}
67-
utils.Logger.ErrorF("auditd: %d events lost due to buffer overflow", count)
73+
utils.Logger.ErrorF("auditd: %d events lost due to buffer overflow or rate limiting", count)
6874
}

0 commit comments

Comments
 (0)