Evaluate systemd logs using Journalctl

Including Kernel Messages

If your want to check for kernel messages, you can do so for the current session with journalctl -k. For information on previous sessions, use journalctl -k -b -n.

The option -p determines the priority of displayed messages. For instance, journalctl -p err shows error messages whereas journalctl -p crit displays critical messages. The log levels are the usual syslog log levels as documented in syslog(3) which you can find online, for instance on Wikipedia [4]. Both numeric and text values are accepted.

Analysis Options

Before we had systemd, if your system didn't recognise an external drive such as a USB stick, your only choice was to examine the output of dmesg using the command tail -n 10. This would show the last ten lines of output, hopefully displaying when the stick was connected. Journalctl has a built-in function for this. Use journalctl -n <value> to display the last x number of lines.

System admins also used to use the command tail -f to keep track of log files. On operating systems using systemd, you can now achieve the same thing by running journalctl -f. By way of example, run the command journalctl -u apache2 -f. Use Ctrl+C to interrupt the continuous output.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content