Skip to content

Commit 6cb6c41

Browse files
committed
fix(agent): reduce auditd log noise with threshold and execve filter
- Add 50 event threshold for EventsLost logging (ignore 1-2 event losses) - Filter execve rules to real users only (auid>=1000, auid!=-1) - Simplify EventsLost function
1 parent 5b7cc19 commit 6cb6c41

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

agent/collector/auditd/stream.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import (
1010
"github.com/utmstack/UTMStack/agent/utils"
1111
)
1212

13+
const (
14+
// eventsLostThreshold - only log when this many events are lost at once.
15+
eventsLostThreshold = 50
16+
)
17+
1318
// eventStream implements libaudit.Stream interface for reassembled events
1419
type eventStream struct {
1520
queue chan *plugins.Log
@@ -45,7 +50,6 @@ func (s *eventStream) ReassemblyComplete(msgs []*auparse.AuditMessage) {
4550
}
4651

4752
// Non-blocking send: drop events if queue is full to prevent backpressure
48-
// This is the "user-space" backpressure mitigation strategy from Elastic Auditbeat
4953
select {
5054
case s.queue <- log:
5155
// Event sent successfully
@@ -55,12 +59,10 @@ func (s *eventStream) ReassemblyComplete(msgs []*auparse.AuditMessage) {
5559
}
5660
}
5761

58-
// EventsLost is called when events were lost due to buffer overflow or rate limiting
62+
// EventsLost is called when events were lost due to buffer overflow
5963
func (s *eventStream) EventsLost(count int) {
60-
// Ignore invalid counts - large values indicate sequence number rollover/overflow
61-
// not actual lost events. A reasonable max is 100K events lost in one batch.
62-
if count <= 0 || count > 100000 {
64+
if count < eventsLostThreshold {
6365
return
6466
}
65-
utils.Logger.ErrorF("auditd: %d events lost due to buffer overflow or rate limiting", count)
67+
utils.Logger.ErrorF("auditd: %d events lost due to buffer overflow", count)
6668
}

agent/dependency/auditd_linux.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ const auditRulesContent = `## UTMStack SIEM Audit Rules
2828
## Additive rules - does not delete existing configuration
2929
3030
# Monitor executed commands (critical for SIEM)
31-
-a always,exit -F arch=b64 -S execve -k utmstack_exec
32-
-a always,exit -F arch=b32 -S execve -k utmstack_exec
31+
# Filter: auid>=1000 (real users only), auid!=-1 (valid audit UID, excludes system processes)
32+
-a always,exit -F arch=b64 -S execve -F auid>=1000 -F auid!=-1 -k utmstack_exec
33+
-a always,exit -F arch=b32 -S execve -F auid>=1000 -F auid!=-1 -k utmstack_exec
3334
3435
# Privilege escalation
3536
-a always,exit -F arch=b64 -S setuid,setgid,setreuid,setregid,setresuid,setresgid -F auid>=1000 -k utmstack_priv

0 commit comments

Comments
 (0)