Linux Labs

Packages, services, and logs / Stage 12 of 13

Log rotation and retention

Not running Starting usually ~20 s
Leave the lesson

Step 8 of 9 · lab · 25 minmedium

Bound training journal retention

A separate systemd journal namespace has grown too large. Save the records you need, set a persistent limit and clean old archives of this namespace only.

Situation

The training service lab-retention-seed writes to a separate systemd journal namespace, lab-retention. The namespace has its own instance, systemd-journald@lab-retention.service, and its own configuration, /etc/systemd/journald@lab-retention.conf. Its archives already take more than 24 MiB. Among the old records are three needed for an incident review: their text starts with lab-evidence:. The main system journal is outside this task.

Task

  1. The three lab-evidence: records of the lab-retention-seed service are saved to /home/student/journal-evidence.txt in short-iso format (with date and time): exactly those three lines, in a file you own.
  2. /etc/systemd/journald@lab-retention.conf sets a persistent limit SystemMaxUse=16M; the other settings stay as they were, and there are no extra settings files.
  3. The namespace's archived files take at most 16 MiB (the current active file doesn't count).
  4. The namespace's journal instance runs with the new setting and accepts new records.
  5. The main journal and its settings, the lab-retention-seed service and its program are untouched.

Constraints

  • Don't delete or truncate journal files by hand — use journalctl only.
  • Don't reconfigure or clean the main systemd-journald.
  • Don't disable logging or redirect it to /dev/null.

The tools you need are already installed. There's no internet on this machine.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 5
  • The three timestamped lab-evidence records are saved in journal-evidence.txt — not done yet
  • Only SystemMaxUse changed in the namespace configuration — to 16M — not done yet
  • Archives of the lab-retention namespace take at most 16 MiB — not done yet
  • The journal instance was restarted with the new setting and accepts new records — not done yet
  • The main journal, its settings and the task files are untouched — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 5
  • The three timestamped lab-evidence records are saved in journal-evidence.txt — not done yet
  • Only SystemMaxUse changed in the namespace configuration — to 16M — not done yet
  • Archives of the lab-retention namespace take at most 16 MiB — not done yet
  • The journal instance was restarted with the new setting and accepts new records — not done yet
  • The main journal, its settings and the task files are untouched — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 5
  • The three timestamped lab-evidence records are saved in journal-evidence.txt — not done yet
  • Only SystemMaxUse changed in the namespace configuration — to 16M — not done yet
  • Archives of the lab-retention namespace take at most 16 MiB — not done yet
  • The journal instance was restarted with the new setting and accepts new records — not done yet
  • The main journal, its settings and the task files are untouched — not done yet
Loading…