How to rotate systemd-journald log under /var/log/journal/*/ or /run/log/journal/*/?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8

Issue

  • How to rotate systemd-journald log under /var/log/journal/*/ ?
  • Is it possible to control its behavior?

Resolution

  • Journal log can be rotated without setting changes.

  • It is set in /etc/systemd/journald.conf file.

  • Useful parameters are as below:

    1. SystemMaxUse= and RuntimeMaxUse= control how much disk space the journal may use up at maximum. Default to 10% of the respective file system size.
    2. SystemKeepFree= and RuntimeKeepFree= control how much disk space systemd-journald shall always leave free for other uses. Default to 15% of the respective file system size. The systemd-journald will respect both limits, but use the smaller value.
  • Refer to man 5 journald.conf for more details.

  • How to enable persistent logging for the systemd journal

SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.