Logging in Linux
In earlier chapters, we already encountered the journalctl
command. In this chapter, I'll discuss this command in much more detail.
In Linux distributions, such as the latest versions of RHEL/CentOS, Debian, Ubuntu and SUSE, that uses systemd as their init system, the systemd-journald
daemon is used for logging. This daemon collects the standard output of a unit, syslog message, and, if the application support it: direct messages from the application to systemd.
The logs are collected in a database that can be queried with journalctl
.
Working with journalctl
If you execute systemctl status <unit>
, you already see the last entries of the logging. To see the full log, journalctl
is the tool that you need. There is a difference with systemctl
: you can view the status on other hosts, using the -H
parameter. You can't use the journalctl
to connect to other hosts. Both utilities have the parameter -M
to connect to systemd-nspawn
and Rkt
containers.
To view the entries in the...