logrotate - setup notes
Logrotate uses the following files:
/etc/logrotate.conf - configuration
- may not need to be edited?
/etc/logrotate.d/ - directory with configuration files that are included by the configuration file.
- here you put your own scripts and edit the syslog file so it rotates as desired.
/var/lib/logrotate/status
- statusfile for logrotate, its "memory"
The logrotate command itself is done by a premade cronjob, about 04:40 every day on Slackware.
You may also force a run of it (-f is for force and -v is for verbose):
logrotate /etc/logrotate.conf -f -v
Without -f it may stop because the data in /var/lib/logrotate/status says no.
A typical config file in /etc/logrotate.d/
/var/log/test {
# create test.1, test.2, test.3 and move around
rotate 3
# do not rotate if logfile is empty
notifempty
# only rotate if logfile exceeds 5 MB
size 5M
# it is okay if logfile is missing
missingok
# run daily (just tells logrotate it is okay to work today)
daily
# when the logfiles are moved around, create a new one
copytruncate
}
This is a personal note. Last updated: 2014-11-27 10:24:07.



