From a60a91bff838f16e5d160780e51f456e5842a2d2 Mon Sep 17 00:00:00 2001 From: cynfo3000 Date: Wed, 4 Mar 2026 23:35:21 +0100 Subject: [PATCH] Fix: Security collector debug logging + backend rebuild needed --- agent/collector/security.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/agent/collector/security.go b/agent/collector/security.go index 06f585b..a80daca 100644 --- a/agent/collector/security.go +++ b/agent/collector/security.go @@ -3,6 +3,7 @@ package collector import ( "bufio" "fmt" + "log" "os" "os/exec" "regexp" @@ -72,7 +73,12 @@ func CollectSecurity() *SecurityData { seen := make(map[string]bool) for _, path := range logFiles { - events := parseAuditLog(path) + events, err := parseAuditLog(path) + if err != nil { + log.Printf("Security: %s: %v", path, err) + continue + } + log.Printf("Security: %s: %d events", path, len(events)) for _, e := range events { key := e.Timestamp + e.User + e.Source + e.Port + e.Status if !seen[key] { @@ -118,10 +124,10 @@ func CollectSecurity() *SecurityData { return data } -func parseAuditLog(path string) []LoginEvent { +func parseAuditLog(path string) ([]LoginEvent, error) { f, err := os.Open(path) if err != nil { - return nil + return nil, err } defer f.Close() @@ -166,7 +172,7 @@ func parseAuditLog(path string) []LoginEvent { } } - return events + return events, nil } func extractTimestamp(line string) string {