systemd comes with its own logging mechanism (“The Journal”) that logs system
messages. This allows to display the service messages together with status messages.
The status command works similar to tail and can also display the log messages
in different formats, making it a powerful debugging tool.
Show Service Start-Up Failure
Whenever a service fails to start, use systemctl status
<my_service>.service to get a detailed error message:
www.example.com: ~ # systemctl start apache2.service
Job failed. See system journal and 'systemctl status' for details.
www.example.com: ~ # systemctl status apache2.service
Loaded: loaded (/lib/systemd/system/apache2.service; disabled)
Active: failed (Result: exit-code) since Mon, 04 Jun 2012 16:52:26
+0200; 29s ago
Process: 3088 ExecStart=/usr/sbin/start_apache2 -D SYSTEMD -k start
(code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/apache2.service
Jun 04 16:52:26 g144 start_apache2[3088]: httpd2-prefork: Syntax error on
line
205 of /etc/apache2/httpd.conf: Syntax error on li...alHost>
Show Last n Service Messages
The default behavior of the status subcommand is displaying the last ten mes-
sages a service issued. To change the number of messages to show, use the
--lines=n parameter,
systemctl status ntp.service
systemctl --lines=20 status ntp.service
Show Service Messages in Append Mode
To display a “live stream” of service messages, use the --follow option, which
works just like tail -f:
systemctl --follow status ntp.service
Messages Output Format
The --output=mode parameter allows to change the output format of service
messages. The most important modes available are:
short
The default format. Shows the log messages with a human readable timestamp.
The systemd daemon 137