How to see logging for a specific unit or service?
Use the journalctl command and filter the output by selecting a specific systemd unit.
journalctl --unit=UNIT
The journalctl command can show the events from its journal by --unit= followed by the service or its unit name. This way events will be filtered, making it much easier to troubleshoot a particular service.
Example
journalctl -u nginx.service
Learn more about journalctl
This article uses the journalctl command to achieve its tasks. For this popular tool there is a cheat sheet available!
This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.
Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!