Linux Labs

Packages, services, and logs / Stage 12 of 13

Log rotation and retention

Not running Starting usually ~20 s
Leave the lesson

Step 6 of 9 · on a machine · 3 min

Rotation without losing writes

The rule for app.log has never run yet. Check it before the first run: after rotation the program must keep writing.

Exercise · do it

Rotate the log without breaking writes

You are in /srv/rotate-lab. Rotate the log by the logrotate.conf rule with the /srv/rotate-lab/state state file. Afterwards the old log text must sit in app.log.1, and the /usr/local/libexec/lab-log-write program run as you must append to the new app.log. Later rotations by this rule must keep the log writable for it too.

Sign in and start The machine is available after signing in

Goals · 0 of 3

  • Keep the old log text in app.log.1 not done yet
  • Append a line to the new app.log with the program not done yet
  • Keep the rule fit for later rotations not done yet

Step goals

0 of 3
  • Keep the old log text in app.log.1 — not done yet
  • Append a line to the new app.log with the program — not done yet
  • Keep the rule fit for later rotations — not done yet
Ubuntu 24.04

Step goals

0 of 3
  • Keep the old log text in app.log.1 — not done yet
  • Append a line to the new app.log with the program — not done yet
  • Keep the rule fit for later rotations — not done yet
Loading…