| Flag | Usage |
|---|---|
| -d | debug mode : (implies -v : verbose mode) no changes will be made to the logs or to the state file |
| -f |
|
|
-s stateFile --state stateFile |
|
| Directive | Usage |
|---|---|
| compress | compress old versions of logfiles with gzip |
| compresscmd /bin/bzip2 | compress logs with /bin/bzip2 instead of the default gzip
Should be used with compressext, otherwise compressed files get a .gz extension.
|
| compressext .bz2 | give compressed files a .bz2 extension |
| copytruncate | To be used when the program writing into the logfile is not able to close and release it.
create a copy of the logfile, then truncate the original logfile.
There is a very small time slice between copying the file and truncating it, so some logging data might be lost.
|
| create mode user group | immediately after rotation (before the postrotate script is run), create a new logfile with :
|
| dateext | When rotating logs, instead of appending numbers to successive rotations (from 1 (newest) to n (oldest)), append the log rotation date (default format : YYYYMMDD)
While rotated logs are re-numbered at each rotation, logs with dates are not renamed.
|
| ifempty | rotate the log file even if it is empty (default value) |
| missingok | don't issue an error if the log file is missing |
| notifempty | do not rotate the log file when it is empty |
| olddir path/to/directory | move logs into path/to/directory for rotation
|
| rotate n | Rotate log files n times before removing them. In other words : keep n rotation intervals (days / weeks / months / ...) of logs. |
current date > date in state file, the file is rotated (source)./path/to/serviceName/*log { daily rotate 10 compress create 644 stuart admins missingok olddir /path/to/serviceName/rotatedLogs }
/var/log/tomcat8/catalina.out /var/log/tomcat8/*log { }
/etc/cron.d/logrotate /etc/cron.daily/logrotate