Linux Labs

Packages, services, and logs / Stage 10 of 13

The journal as evidence

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 7 · theory · 5 min

Selecting by time

Over a week a service piles up hundreds of records. Time and the boot number leave the part you need.

-b, familiar from the diagnosis lesson, keeps the records of the machine's current boot, -b -1 those of the previous one. The training machine has booted once, and -b -1 prints No journal boot entry found from the specified boot offset (-1).

--since and --until set time limits: --since "2026-10-18 17:43:37", --since today, --since -5min. -n 20, as before, keeps the last 20 records. -o short-iso prints the full time, with the date and time zone — such a selection is easier to compare with someone else's.

A selection is saved to a file with redirection: sudo journalctl -u lab-demo.service --no-pager > ~/demo.log. sudo applies to journalctl, while your shell opens the file, so the file belongs to you.

Check yourself 1 question

The service has two runs: at 17:43:36 and at 17:43:38. What will this command show?

$ sudo journalctl -u lab-demo.service --since "2026-10-18 17:43:37"
  • --since means "starting from": records from the mark onwards. The first run came before it.

  • --since cuts off everything before the mark: the run at 17:43:36 falls short of it.

--since keeps records from the given moment onwards, so the selection holds just the 17:43:38 run. --until limits a selection from above.

Key points

  • -b is the current boot, --since and --until set time limits, -n keeps the last records.
  • -o short-iso prints the time with the date and time zone.
  • With sudo journalctl … > file your shell creates the file, and it belongs to you.
Ubuntu 24.04
Loading…