Fix: Security collector debug logging + backend rebuild needed

This commit is contained in:
cynfo3000 2026-03-04 23:35:21 +01:00
parent 772a1fd7a6
commit a60a91bff8

View File

@ -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 {