Configuring systemd-journald to store logs persistently

systemd-journal is stored in the /run/log/journal directory, which is cleared on system reboot. Its configuration file is /etc/systemd/journald.conf, which can be used to fine-tune journal parameters such as the amount of filesystem to be used for storing the journal (default value is 10%).

systemd-journal is configured in such a way that if the /var/log/journal/ directory exists in the system, then it logs journal entries in that directory instead of /run/log/journal/. The same concept is used to made systemd-journal storage persistent across reboot. The following steps are to be taken to make systemd-journal persistent:

  1. Create the /var/log/journal/ directory as root user as shown in the following command line:
# mkdir /var/log/journal
  1. Make the owner of the directory created as root and group as systemd-journal with permissions 2755 as shown in the following command line:
# chown root:systemd-journal /var/log/journal
# chmod 2755 /var/log/journal
  1. Reboot your system or send the USR1 signal to systemd-journald as shown in the following command line:

# killall -USR1 systemd-journald
  1. Make sure systemd-journal is persistent after reboot by listing a new directory containing journal log files inside the /var/log/journal directory as shown in following command line:
# ls /var/log/journal
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.34.178