Skip to content

Log rotation + retention

logrotate

  • Config in repo: infra/logrotate/forge.conf
  • Installed: /etc/logrotate.d/forge (owner root:root, 644). System logrotate runs daily, picks it up automatically.
  • Reinstall after edit: sudo cp /home/justinwieb/forge/infra/logrotate/forge.conf /etc/logrotate.d/forge
  • Dry-run / debug: sudo logrotate -d /etc/logrotate.d/forge
  • Force rotate now: sudo logrotate -f /etc/logrotate.d/forge
  • Buckets:
  • Monitor logs (monitor-*.log, cron-errors.log): weekly, 8 generations, 10 MB size, copytruncate
  • Service logs (dispatcher, home-base, inbox-webhook, telegram-*, search-index): weekly, 4 generations, 10 MB size
  • logs/integrations/*.log + logs/integrations/telegram/*.log: weekly, 4 generations
  • logs/workers/*.log: monthly, 2 generations
  • All buckets use copytruncate so the tailing systemd services / cron jobs don't need restart.

retention sweep

  • Script: scripts/cleanup/retention.sh
  • Cron: nightly at 04:15 (# forge-retention block in crontab)
  • What it does: moves files older than RETENTION_DAYS (default 30) into <dir>/_archive/YYYY-MM/ for these four locations:
  • comms/results/
  • comms/inbox/
  • tasks/completed/
  • tasks/failed/
  • logs/workers/
  • Log: logs/retention.log (one summary per run, === retention sweep start/done ===)
  • Override window: RETENTION_DAYS=14 ./scripts/cleanup/retention.sh for a one-off
  • Never deletes — only moves into _archive/. Justin or future cleanup pass decides cold storage / drop.