By default, logrotate
runs once a day, using a cron scheduler from /etc/cron.daily/
# ls /etc/cron.daily/ logrotate
Configuration files for logrotate:
- default configuration
/etc/logrotate.conf
:
$ cat /etc/logrotate.conf # see "man logrotate" for details # rotate log files weekly weekly # keep 4 weeks worth of backlogs rotate 4 # create new (empty) log files after rotating old ones create # use date as a suffix of the rotated file dateext # uncomment this if you want your log files compressed #compress # RPM packages drop log rotation information into this directory include /etc/logrotate.d # system-specific logs may be also be configured here.
- custom configurations in
/etc/logrotate.d
:
# Example /var/log/thinkhel.log { rotate 3 missingok notifempty compress size 50k daily }
- rotate – log retention
- missingok – do not issue an error message if the file is missing
- notifempty – do not rotate if the file is empty
- compress – log files are compressed with gzip
To force a logrotate run to test configuration:
sudo logrotate -f -v /etc/logrotate.d/thinkel