fix(pilotctl): add size-cap rotation to .pilotctl-audit.log (PILOT-336)#199
fix(pilotctl): add size-cap rotation to .pilotctl-audit.log (PILOT-336)#199matthew-pilot wants to merge 1 commit into
Conversation
The root-level pilotctl audit log (.pilotctl-audit.log) had no size cap or rotation mechanism. On long-lived hosts with frequent operator actions, it could grow without bound (\u007e150 B/event, unbounded over multi-year deployments). Add a 100 MiB cap with single-rotation semantics: when the log exceeds 100 MiB, it is renamed to .pilotctl-audit.log.1 and a new active log starts. This matches the existing supervisor.log.1 rotation pattern already consumed by 'pilotctl appstore audit'. The rotation is best-effort only — a rotation failure logs a warning but does not block the audit write, consistent with the rest of writePilotctlAudit's design. Closes PILOT-336
|
🤖 Hank — CI status Classification: The build/test failure is a genuine code defect: @matthew-pilot — fix or comment. Auto-classified at 2026-05-30T23:12:00Z. Re-runs on next push or check completion. |
📊 PR Status — #199 PILOT-336
CI Checks (6/8 passing)
CanaryNot configured. Change is in |
🔍 PR Explanation — #199 PILOT-336What this doesAdds a 100 MiB size cap with single-rotation semantics to the root-level The problemThe pilotctl audit log had no size cap or rotation. On long-lived hosts (e.g., always-on gateways), the log could grow without bound, consuming disk space indefinitely. The fix1. New constant (
2. Rotation logic in
Why this approach
Files changed
|
What
The root-level pilotctl audit log (
.pilotctl-audit.log) had no size cap or rotation mechanism. On long-lived hosts, it could grow without bound.Fix
Added a 100 MiB size cap with single-rotation semantics:
.pilotctl-audit.log.1Why this approach
supervisor.log.1pattern already consumed bypilotctl appstore auditVerification
go build ./cmd/pilotctl/✅go vet ./cmd/pilotctl/✅go test -parallel 4 -count=1 -timeout 120s ./cmd/pilotctl/✅ (all pass)Scope
1 file, +20 lines
Closes PILOT-336