1# Logging {#sec-logging}
2
3System-wide logging is provided by systemd's *journal*, which subsumes
4traditional logging daemons such as syslogd and klogd. Log entries are
5kept in binary files in `/var/log/journal/`. The command `journalctl`
6allows you to see the contents of the journal. For example,
7
8```ShellSession
9$ journalctl -b
10```
11
12shows all journal entries since the last reboot. (The output of
13`journalctl` is piped into `less` by default.) You can use various
14options and match operators to restrict output to messages of interest.
15For instance, to get all messages from PostgreSQL:
16
17```ShellSession
18$ journalctl -u postgresql.service
19-- Logs begin at Mon, 2013-01-07 13:28:01 CET, end at Tue, 2013-01-08 01:09:57 CET. --
20...
21Jan 07 15:44:14 hagbard postgres[2681]: [2-1] LOG: database system is shut down
22-- Reboot --
23Jan 07 15:45:10 hagbard postgres[2532]: [1-1] LOG: database system was shut down at 2013-01-07 15:44:14 CET
24Jan 07 15:45:13 hagbard postgres[2500]: [1-1] LOG: database system is ready to accept connections
25```
26
27Or to get all messages since the last reboot that have at least a
28"critical" severity level:
29
30```ShellSession
31$ journalctl -b -p crit
32Dec 17 21:08:06 mandark sudo[3673]: pam_unix(sudo:auth): auth could not identify password for [alice]
33Dec 29 01:30:22 mandark kernel[6131]: [1053513.909444] CPU6: Core temperature above threshold, cpu clock throttled (total events = 1)
34```
35
36The system journal is readable by root and by users in the `wheel` and
37`systemd-journal` groups. All users have a private journal that can be
38read using `journalctl`.