Logging
System logs
How to enable persistent logging
To make journald store logs persistently across boots:
- Shut down the RPi.
- Remove the RPi's SD card and insert it into your own computer instead.
- Mount the SD card's root partition on your computer.
- Make a new directory in the SD card's root partition at
/etc/systemd/journald.conf.d. - In the new directory at
/etc/systemd/journald.conf.d, make a new file named99-persistent-storage.conf, with the following contents:[Journal]
Storage=persistent - Reboot
warning
Storing logs persistently will wear out the SD card more quickly, so only do this if necessary!
To undo this change:
- Shut down the RPi.
- Remove the RPi's SD card and insert it into your own computer instead.
- Mount the SD card's root partition on your computer.
- Delete the file at
/etc/systemd/journald.conf.d/99-persistent-storage.conf. - Reboot
How to check logs from a previous boot
After enabling persistent logging:
- Enter the RPi's terminal.
- Run the command
journalctl --boot=-{n}to check the logs fromnboots ago. For example, runjournalctl --boot=-1to check the logs from the previous boot.