The journal accumulates records of what happened on the machine. A service's state describes only its last run.
The systemd journal collects messages from the whole machine: from the kernel, from systemd, from services — everything their programs print to their output. Each line is a record: the time, the machine name, the source with its process number in brackets, and the text. lab-demo[1116]: settings-missing is a record from the lab-demo program with PID 1116.
Records do not vanish when the service recovers: the old failure stays in the journal above the new successful run. So you ask systemctl about the current state, and the journal shows what happened and in which order.
You have already read a single service's journal in the module on services: sudo journalctl -u for cron, nginx and lab-worker. sudo journalctl with no options prints the machine's whole journal, -u keeps one service's records, and without --no-pager the output opens in the less pager (exit with q). Service and system records are readable by root and the adm and systemd-journal groups, while student sees only its own. Check this on lab-demo without sudo:
journalctl prints the hint Hint: You are currently not seeing messages from other users and the system and -- No entries --. The same goes for systemctl status: it shows the service's latest records under its state only with sudo.
The service's journal, requested without sudo, printed this. What does that mean?
$ journalctl -u lab-demo.service --no-pager
Hint: You are currently not seeing messages from other users and the system.
Users in groups 'adm', 'systemd-journal' can see all messages.
Pass -q to turn off this notice.
-- No entries --
-
The records are in place: with
sudothey show up. Without the rights, the journal shows student only its own records. -
With the same name and
sudothe records were found. The issue is permission to read the journal. -
With
sudothe same command showed both runs. The empty output is about permissions, which is what theHintsays.
Service records are readable by root and the adm and systemd-journal groups. student sees only its own records, so without sudo the selection is empty.
Key points
- The journal keeps the records of every run: time, source with PID, and text.
-
Ask
systemctlabout a service's current state, and the journal about what happened to it. -
student reads service records through
sudo, otherwise it sees-- No entries --.