Skip to content

provisioner: cap the console logs under --log-dir - #212

Merged
linyiru merged 1 commit into
mainfrom
console-log-cap
Nov 8, 2026
Merged

linyiru merged 1 commit into
mainfrom
console-log-cap

Conversation

@linyiru

@linyiru linyiru commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Each runner's serial console was copied to its own file under --log-dir:

  • with no size limit;
  • with no retention;
  • with write errors swallowed on purpose, so that a failing log never stops the console copy.

A job writing to the console could therefore fill the host's disk, and the logs of finished runners piled up forever.

Changes:

  • Per-runner cap: each file keeps at most --log-max-mib / FR_LOG_MAX_MIB (default 64), then one line saying the rest was dropped.
  • Directory budget: before a new runner's log is opened, the oldest .log files are removed until all of them fit in --log-dir-max-mib / FR_LOG_DIR_MAX_MIB (default 2048). Other files in the directory are never touched.
  • Permissions: the files are created 0600 and the directory 0700, since the console can carry what a job printed.
  • Validation: both values must be ≥ 0, and the per-runner cap cannot exceed the directory budget.
  • README: it now also says that the console reaches the daemon's own log at --log-level debug.

Tests are in internal/provisioner/consolelog_test.go and internal/config/config_test.go. scripts/mutate.sh confirmed that removing the cap, or removing the pruning, makes them fail.

Each runner's serial console was copied to its own file with no limit,
no retention and write errors deliberately swallowed, so a job writing
to the console could fill the host's disk, and logs of finished runners
piled up for ever. Each file now keeps at most --log-max-mib (default
64), ending with a line saying the rest was dropped, and before a new
runner's log is opened the oldest are removed until all of them fit in
--log-dir-max-mib (default 2048). The files are created 0600 and the
directory 0700, since the console can carry what a job printed.

The README also says the console reaches the daemon's own log at
--log-level debug, which it already did.

Signed-off-by: Yi-Ru Lin <deduce@gmail.com>
@linyiru
linyiru enabled auto-merge November 8, 2026 03:16
@linyiru
linyiru merged commit 64ebdeb into main Nov 8, 2026
7 checks passed
@linyiru
linyiru deleted the console-log-cap branch November 8, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant