Linux Labs

Packages, services, and logs / Stage 10 of 13

The journal as evidence

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 7 · on a machine · 5 min

The service is fine, the journal shows an error

What you will learn

  • Select journal records by service, boot, time and priority.
  • Tell a service's run history apart from its current state.
  • Save a journal excerpt to your own file for review.

The lab-demo reporting service failed overnight, and in the morning a colleague fixed it and writes: "Everything works." Check how its last run ended and what the journal recorded about it.

Exercise · look

The service state and its journal

Find out how the last run of lab-demo.service ended, and read that service's journal.

First, predict

The service's last run succeeded. What will its journal hold?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

Why is there an error in the journal of a service whose last run succeeded?

  • Result describes the last run. After the error the journal shows a second run with report-ready mode=training, and that one succeeded.

  • There was a restart: after the error the journal shows a second run, start and report-ready mode=training.

  • journalctl reads the journal. systemd and the lab-demo program wrote the lines at the time of the runs, earlier than your command.

The journal keeps the records of every run of the service, and the first of them ended in failure.

Ubuntu 24.04
Loading…