LoggingThe Ultimate Guide

your open-source resource for understanding, analyzing, and troubleshooting system logs

curated byloggly

0

Managing Journal Size

We saw how systemd journal size can be controlled with configuration parameters. Even with default configuration values, systemd-journald will ensure that older journal records or journal files are deleted to keep the correct amount of disk space free. We can also use some of the options of journalctl to manage the journal.

To check how much disk space is currently taken up by the journal, use the –disk-usage parameter:

Depending on the version of journalctl, the output can be similar to this:

or

You can also manage disk space taken up by systemd journal by fine-tuning these configuration parameters:

  • Compress
  • SystemKeepFree
  • RuntimeKeepFree
  • SystemMaxFileSize
  • RuntimeMaxFileSize
  • MaxRetentionSec
  • MaxFileSec

Deleting or Vacuuming Journals

To delete archived journal entries manually, you can use either the –vacuum-size or the –vacuum-time option. In the example below, we are deleting any archived journal files so the journal size comes back to 200 MB:

The output should be something similar to this:

When using –vacuum-time option, archived journals older than the time specified will be deleted.

These two options are available from systemd version 218.

Verifying Journals

To verify the journal for internal consistency, use the –verify option:

There will be a graphical progress bar as the check is done. Sometimes the alrert messages will be shown:

Written & Contributed by

Sadequl

This guide will help software developers and system administrators become experts at using logs to better run their systems. This is a vendor-neutral, community effort featuring examples from a variety of solutions

Meet Our Contributors Become a contributor