Journalctl
How to limit the disk usage of the systemd journal
Learn how to define the maximum size that the systemd journal daemon may use for storing journals.
Summary
To limit the maximum size that journals may use on the system, define the setting SystemMaxUse in /etc/systemd/journald.conf. Save the file, confirm that the settings are correct, then restart the journal daemon. Configuration Open /etc/systemd/journald.conf, copy the commented line, remove the hash, and assign it a value. SystemMaxUse=256M Note: depending on how many events happen on a system, this value might be too small. Make sure that the size for logs is big enough.
How to see the size of the systemd journal
Summary
The journalctl command can be used to show the journal. By using the --disk-usage option, the size of the journal is displayed. This includes the archived and active journal files. When the journal is using too much disk space, consider performing a vacuum task. Usage Showing the disk usage is quick and easy. # journalctl --disk-usage Archived and active journals take up 56.0M in the file system. Does the journal take up too much space?
How to see kernel messages with journalctl
Learn how to show all kernel events by using journalctl and filter out the kernel entries in the journal.
Summary
The journalctl command can show all events related to the kernel itself usig the --dmesg option. This option will filter out kernel messages and has a similar output as the dmesg command. Usage Use the full or shorter option to query the kernel messages. journalctl -k Looking for only the kernel messages of today? Combine it with the --since= option. journalctl -k -S "today"
How to see only recent journal entries
Learn how to filter journal entries by specifying a date or time interval.
Summary
The journalctl command shows by default the oldest entries it has in the journal. Typically we are not interested in that, for that purpose there is the --since= option. This option defines that entries should be after the specified moment in time. Besides using an actual date, a shortened name like ’today’ can also be used that automatically defines the date and time. Usage To see the entries of today, use the aptly named ’today'.
How to see new log entries automatically with journalctl
Learn how to continuously show new log entries with journalctl like the tail -f command.
Summary
The journalctl command can show continuously new log entries with the --follow option. When new entries are added to the journal, they are automatically shown. Usage The follow option is a great option to continuously monitor a particular unit. journalctl --follow --unit=nginx.service Without providing a unit, all system events will be shown and followed.
How to see logging for a specific unit or service
Limit the number of log entries from the systemd journal by filtering journalctl output by unit.
Summary
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
How to see the last X lines with journalctl
Limit the output from journalctl by defining the number of lines you want to see.
Summary
Perform smarter queries when requesting information from journalctl
Journalctl cheat sheet
Learn how to get every piece of information from systemd journals with the journalctl command. This cheat sheet will help you with the task.
Summary
Query the journal and find the needle
Finding boot logs in systemd journals
This article shows how to find boot logs in the systemd journal. Learn the commands to query all relevant information.
Summary
Systemd used a binary log to store information about specific events. These events include the boot sequence and the related output. In this article we have a look at finding our boot logs in systemd journals. Binary logging When using systemd, boot data is stored in journals, a binary format. There is big benefit of saving boot data in a binary format: log information of each boot can be stored separately, linked to other pieces of information, and queried easier and quicker.