Refine log monitoring predicate to filter for specific session violations

This commit is contained in:
JY Tan
2025-12-19 12:24:01 -08:00
parent 34d6e51c4b
commit b220c42614

View File

@@ -42,12 +42,10 @@ func (m *LogMonitor) Start() error {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
m.cancel = cancel m.cancel = cancel
// Build predicate to filter for our session's violations // Build predicate to filter for this session's violations only
// Note: We use the broader "_SBX" suffix to ensure we capture events predicate := fmt.Sprintf(`eventMessage ENDSWITH "%s"`, m.sessionSuffix)
// even if there's a slight delay in log delivery
predicate := `eventMessage ENDSWITH "_SBX"`
m.cmd = exec.CommandContext(ctx, "log", "stream", m.cmd = exec.CommandContext(ctx, "log", "stream", //nolint:gosec // predicate is constructed from trusted session suffix
"--predicate", predicate, "--predicate", predicate,
"--style", "compact", "--style", "compact",
) )