Reading and Configuring System Logs (journalctl)

Created by Michael Lister, Modified on Mon, 9 Dec, 2024 at 10:40 AM by Michael Lister

This guide will show you how to read the system logs from a Raspberry Pi running Raspbian



Configuring Persistent System Logs 


To allow for the logs in their entirety to be kept between boots, persistent logging needs to be enabled:


1. Open Terminal


2. Type:

sudo nano /etc/systemd/journald.conf

3. This will open a text editor within the terminal to edit the journal config file

Using the down arrow key scroll down to the [Journal] area


4. locate the "Storage=" option

Change it's value to "persistent"


5. Press CTRL + X


6. Press Y to save changes


7. Press ENTER to apply




Reading System Logs



Reading the log from the current boot


1. Open Terminal


2 Type: 


journalctl -b


3. The log for the current log will then be displayed within the terminal

Use Page Up/Down to scroll through the log




Listing Boot Log Records


1. Open Terminal


2. Type:


journalctl --list-boots


3.  A list of log files will be displayed, one is created after each boot

Along with the date/time of the first & last entry


You can make a note of the Index value or Boot ID to view the log later



Reading the Log from a previous Boot


Using the info from the boot list in the step above, you can view a log from a previous boot


1. Open Terminal


2. Type:


journalctl -b -X

Where X is the index of the log, as per the boot list


e.g. journalctl - b -1 will show the log from the previous boot, instead of the current one








Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article