Slackware HowTo

Configure logrotate on Slackware (base)

Clean log rotation to avoid disk fill-up and keep a useful history.

1. Why use logrotate

2. Global config

Check the main file (typically):

/etc/logrotate.conf

Also check included directories (if present).

3. Example config for a custom log

/var/log/myapp/*.log {
    weekly
    rotate 8
    compress
    missingok
    notifempty
    create 0640 root root
    sharedscripts
    postrotate
        /etc/rc.d/rc.myapp restart >/dev/null 2>&1 || true
    endscript
}

4. Meaning of key options

5. Manual test

logrotate -d /etc/logrotate.conf   # debug, no changes
logrotate -f /etc/logrotate.conf   # force rotation
Use -f with care on production systems: it may rotate many files at once.

6. Checks

ls -lh /var/log/myapp
tail -n 50 /var/log/messages

7. Common errors

Quick checklist

[ ] logrotate rule created
[ ] Test with -d completed
[ ] Test with -f completed (if appropriate)
[ ] create permissions verified
[ ] postrotate checked

Back to the Linux HowTo section