brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Storage=volatile keeps the journalctl log in RAM only

Journalctl
~/tips/tip-journalctl-storage-volatile

Storage=volatile

Stop journald from writing logs to an SD card or other fragile storage.

On a Raspberry Pi with an SD card, or a box that boots from a cheap USB stick, the constant writes of the journal wear the card down. You can tell journald to keep logs in memory only.

I would do it with a drop-in:

sudo mkdir -p /etc/systemd/journald.conf.d
sudo tee /etc/systemd/journald.conf.d/50-volatile.conf <<'EOF'
[Journal]
Storage=volatile
RuntimeMaxUse=64M
EOF
sudo systemctl restart systemd-journald

With volatile, the man page says, data is stored only in memory below /run/log/journal. journalctl works exactly as before; it just reads from there. The RuntimeMaxUse= line keeps the log from eating too much RAM on a small board.

The other values: persistent writes to /var/log/journal, auto writes to disk only if that folder exists, and none keeps nothing at all. Your version’s default is in the commented lines of /etc/systemd/journald.conf; on Ubuntu 24.04 it reads #Storage=auto.

The price is obvious once you need it: after a reboot every log line is gone, including the ones that would explain why the machine crashed. If that matters, forward to another machine or keep a small persistent journal on a USB disk instead.

Further reading: journald.conf man page

More Journalctl tips journalctl -k -g 'killed process' --since "2 days ago" journalctl _PID=1 -b ls -lh /var/log/journal/*/*.journal~ sudo journalctl --setup-keys journalctl -F _KERNEL_SUBSYSTEM All Journalctl tips (81) All topics

Link