To adjust the log rotation settings on Debian 12 Bookworm to save space, you can modify the configuration in /etc/logrotate.conf or add specific configurations in the /etc/logrotate.d/ directory for individual log files. Here’s a general approach to help reduce disk usage:

  1. Reduce Retention Time: Lower the number of retained log files by changing the rotate option.
  1. Enable Compression: If not already enabled, ensure compress is included to compress old logs, saving significant space.
  2. Limit File Size: If logs grow quickly, you can rotate them based on size.
  1. Remove Unnecessary Logs: If specific logs are not needed, you can disable rotation for those files.

After editing, apply the settings by running:

To compress old logs on Debian 12, you can enable compression in the logrotate configuration. Here’s how to set it up:

  1. Edit the Main Logrotate Configuration:
    Open /etc/logrotate.conf in a text editor:
  1. Enable Compression:
    Ensure the compress option is included in the configuration to automatically compress old logs. You might also want to use delaycompress so that the most recent rotated file remains uncompressed, in case it needs quick access.
  1. Configure Log Rotation in Specific Files (Optional):
    If you want to set compression for specific log files, you can add these options within individual configuration files in /etc/logrotate.d/. For example:
  1. Test the Configuration:
    After making these changes, test the configuration to make sure it works as expected:

This will compress rotated log files, helping to save disk space on your Debian 12 system.

Leave A Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.