Lion Cipher Lab

Stop a runaway log from filling the disk with logrotate (and measure what create vs copytruncate really cost)

Why it matters

A log that grows forever is one of the most common outages there is: an app gets stuck in an error loop, writes the same warning thousands of times a second, and a few hours later the disk is 100% full. Databases stop accepting writes, services crash, and nobody can even log in to fix it. For a security person there is a second, quieter cost: when the disk is full, the security log cannot be written either. In this lab you will watch a failed-login event be thrown away with 'No space left on device' -- the exact moment you most need a record is the moment you lose it. The standard Linux tool…

What you'll learn

Steps in this lab

  1. Build a throwaway container with a tiny 32 MB 'disk'
  2. Write a fake app that logs forever, the way a real daemon does
  3. BEFORE: let it run away, measure the outage, and watch a security event get thrown away
  4. Write a logrotate config and dry-run it before you trust it
  5. Force it, and watch create fill the disk anyway (du says small, df says full)
  6. AFTER: create + postrotate signal + delaycompress, run often enough to matter
  7. copytruncate: no signal needed, but measure the lines it drops
  8. Where logrotate really runs, and why a daily run cannot save a fast-filling disk
  9. The honest negative: rotation is not retention, and logrotate only guards the files it knows
  10. The judgment: when to reach for which setting

Open the full interactive lab →