Skip to content

Latest commit

Β 

History

History
79 lines (52 loc) Β· 1.96 KB

File metadata and controls

79 lines (52 loc) Β· 1.96 KB

πŸ“š Log Rotation Guide for Redbelly Node Logs

Log rotation ensures that log files do not grow indefinitely, consuming all disk space. Below is a simple guide to set up log rotation for your Redbelly Node.


πŸ› οΈ 1. Create a Log Rotation Configuration File

Open the configuration file for Redbelly logs:

sudo nano /etc/logrotate.d/rbbc_logs

Add the following configuration:

/var/log/redbelly/rbn_logs/rbbc_logs.log {
    daily                   # Rotate logs daily
    size 5G                 # Rotate if log file exceeds 5GB
    rotate 10               # Keep last 10 rotated logs
    copytruncate            # Truncate the original log file after rotation
    missingok               # Ignore if the log file is missing
    notifempty              # Do not rotate if the log file is empty
    compress                # Compress rotated logs
    delaycompress           # Delay compression until the next rotation
    create 0640 rbnuser rbnuser  # Set ownership and permissions
}

Save and close the file.


πŸ”„ 2. Test Log Rotation Configuration

Run the following command to verify your setup:

sudo logrotate -f /etc/logrotate.d/rbbc_logs

Check if new rotated files (rbbc_logs.log.1, rbbc_logs.log.1.gz) have been created:

ls -lh /var/log/redbelly/rbn_logs/

πŸ•’ 3. Verify Scheduled Log Rotation

Log rotation typically runs daily via a systemd timer or cron job. Verify it:

For Systemd:

sudo systemctl status logrotate

For Cron:

Check if logrotate is scheduled under /etc/cron.daily/logrotate.


πŸ“Š 4. Monitor Disk Usage

Ensure logs aren’t consuming excessive disk space:

du -sh /var/log/redbelly/rbn_logs/

βœ… 5. You're All Set!

Your Redbelly Node logs are now managed efficiently with log rotation. Logs will be compressed, archived, and space will be freed periodically.

Feel free to reach out for help or feedback! πŸš€