journalctl is your interface into a single machine’s journal/logging. All service files insert data into the systemd journal. There are a few helpful commands to read the journal:
Read the entire journal
1
2
3
4
5
6
7
8
9
10
11
$ journalctl
-- Logs begin at Fri 2013-12-13 23:43:32 UTC, end at Sun 2013-12-22 12:28:45 UTC. --
Dec 22 00:10:21 localhost systemd-journal[33]: Runtime journal is using 184.0K (max 49.9M, leaving 74.8M of free 499.0M, current limit 49.9M).
Dec 22 00:10:21 localhost systemd-journal[33]: Runtime journal is using 188.0K (max 49.9M, leaving 74.8M of free 499.0M, current limit 49.9M).
Dec 22 00:10:21 localhost kernel: Initializing cgroup subsys cpuset
Dec 22 00:10:21 localhost kernel: Initializing cgroup subsys cpu
Dec 22 00:10:21 localhost kernel: Initializing cgroup subsys cpuacct
Dec 22 00:10:21 localhost kernel: Linux version 3.11.7+ (buildbot@10.10.10.10)(gcc version 4.6.3 (Gentoo Hardened 4.6.3 p1.13, pie-0.5.2)...
1000s more lines
Read entries for a specific service
Read entries generated by a specific unit:
1
2
3
4
5
6
7
$ journalctl -u apache.service
-- Logs begin at Fri 2013-12-13 23:43:32 UTC, end at Sun 2013-12-22 12:32:52 UTC. --
Dec 22 12:32:39 localhost systemd[1]: Starting Apache Service...
Dec 22 12:32:39 localhost systemd[1]: Started Apache Service.
Dec 22 12:32:39 localhost docker[9772]: /usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)Dec 22 12:32:39 localhost docker[9772]: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.6 for ServerName
Read the user journal from the current user
It might be required to add a user different from core user to the systemd-journal group to read the user journal. It can be done with this Butane config:
Reading just the entries since the last boot is an easy way to troubleshoot services that are failing to start properly:
1
journalctl --boot
Tail the journal
You can tail the entire journal or just a specific service:
1
journalctl -f
1
journalctl -u apache.service -f
Read entries with line wrapping
By default journalctl passes FRSXMK command line options to
less
. You can override these options by setting a custom
SYSTEMD_LESS
environment variable with omitted S option:
1
SYSTEMD_LESS=FRXMK journalctl
Read logs without pager:
1
journalctl --no-pager
Debugging journald
If you’ve faced some problems with journald you can enable debug mode following the instructions below.