LogRotate

LogRotate Configuration.

https://www.redhat.com/sysadmin/setting-logrotate

If not installed already (it usually is), install the logrotate service:

apt install logrotate

yum install logrotate

Configuration of logrotate

/etc/logrotate.conf - used to define default parameters for logrotate

/etc/logrotate.d - used for configuring logrotate for specific logs

example configuration:

/root/.unison/unison.log {
    rotate 7
    daily
    compress
    missingok
    notifempty
}

Common options you may see used in a configuration file include:

Running LogRotate

LogRotate usually comes set up with a daily cron:

ls /etc/cron.daily/
apport  apt-compat  dpkg  logrotate  man-db  plocate

You can also run a logrotate configuration at any time:

logrotate name




Revision #3
Created 2023-11-28 18:11:36 UTC by Daniel
Updated 2024-03-09 04:24:07 UTC by Daniel