Skip to content

fix(logs): rotate every VM's log directory and gzip rotated archives - #27

Open
Marinski wants to merge 1 commit into
psyb0t:masterfrom
Marinski:fix/log-rotation
Open

Marinski wants to merge 1 commit into
psyb0t:masterfrom
Marinski:fix/log-rotation

Conversation

@Marinski

@Marinski Marinski commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #24.

  • the rotator walks every directory in LOG_DIRS (generated from each VM's log_dir in vms.yaml) instead of one hardcoded path; a directory named but not mounted is logged and skipped rather than aborting the pass.
  • rotated archives are gzipped; archives written before this are compressed in place on the next pass, and retention reads the date with any .gz stripped so a compressed archive still ages out.

Tests: tests/test_rotate_logs.py (multi-directory) and tests/test_config_generation.py (the generated compose emits a mount and a LOG_DIRS entry per VM).

Each VM mounts its own host directory over /shared/logs (vms.yaml carries
log_dir per VM), so the stack has one log directory per VM. The rotator
mounted /data/mt5-shared/logs and nothing else -- only the fast VM's -- so the
bulk VM's logs were never rotated at all (found 2026-08-21: full.log at
193 MB, no archive since July). Mounts and LOG_DIRS now come from vms.yaml,
deduplicated by log_dir; a topology naming none falls back to the shared
directory, and the singular LOG_DIR is still accepted. A directory named but
not mounted is logged and skipped rather than aborting the pass.

Archives are gzipped. Truncating the host log to 0 does not reset the Windows
guest's cached write offset, so the live file comes back as a hole; busybox
cp does not preserve holes and wrote every zero into the archive -- 2.18 GB
from 13 MB of real text in a single pass, growing daily. gzip turns that run
of zeros back into nothing and needs nothing added to the alpine image.
Archives written before this are compressed in place on the next pass, and
retention reads the date with any .gz stripped first so a compressed archive
still ages out.
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.

Log rotation: only the first VM's directory rotates, and archives balloon to GBs

1 participant