Enable persistent storage for the systemd journal log
The assumed default setting in
Storage=auto which implies that systemd journaling will only persist the journal if the expected storage location is available. Otherwise, the journal data is stored in memory and lost between reboots. On Ubuntu 16.04,
/var/log/journal does not exist by default. Create it to keep and query events from previous boots.
- Syslog still provides the persistant log records for Ubuntu 16.04, so enabling persistant systemd journal logging does cause a level of duplicaiton.
- There are sane defaults:
SystemMaxUseis 10% for peristant storage in
/var/log/journal, or 15% for memory use in
- More config options such as
MaxLevelStorecan help control how fast storage is consumed.
Create storage and enable storage location
mkdir -p /var/log/journal systemd-tmpfiles --create --prefix /var/log/journal systemctl restart systemd-journald
As suggested by several other locations, use
killall -USR1 systemd-journaldinstead of restarting the service. This way you get to keep all the logging of the current session: the memory log gets copied to the new disk location as well as all subsequent events.