Logrotate references

References for Logrotate.

ParametersDescription
rotate countSets log files to rotated for a specified amount of time (counts) before they are mailed or deleted.
compressCompresses rotated log files with the default .gzip format.
nocompressOld log files are not compressed.
delaycompressSets compression of preceding logs to be delayed till after the next rotation.
nodelaycompressCompression of rotated log files are not delayed.
dailySets log rotation to occur daily. This is usually at the first hour of the day.
weeklySets log rotation of log files to occur weekly. It usually happens on the first day of the week.
monthlyRotates log files once a month. This is usually in the first day logrotate runs in a month.
yearlySets log rotation to occur once a year. This is usually at the beginning of the year.
size sizeSets logs to be rotated once they reach a specified size.
minsize sizeLog rotation of the files occur when they are larger than the specified size. Logrotate considers the set time parameter (daily, weekly, monthly, or yearly) before.
maxage countSets legrotate to remove rotated files older than the specified count. The counts is recorded in days.
prerotate+ endscriptThe script or command given between the "prerotate and endscript" are executed before rotating the log files.
postrotate+ endscriptThe script or command given between the "postrotate and endscript" are executed after log rotation.
dateextRotated log files would have a date extension after the file name.
nodateextNo date extension would be displayed.
dateformat format_stringThis displays the file date extension in a specified format. For example, YYMMDD, this would be set using -%Y%M%D.
olddir directoryLog files are moved to the specified directory for rotation.
missingokInstructs logrotate to display no error when a log file is missing
nomissingokWhen a log file is missing during rotation, an error should be displayed.
shredEnables the use of shred -u to delete log files. Once the file has been deleted, the shred parameter makes sure the logs are not readable after the deletion.
noshredNo use of shred to delete files.
shredcycles countoverrides log files a number of specified times before they are deleted.
mailSend rotated log files to a specified email address.
mailfirstInstructs logrotate to mail the recently rotated logs rather than the oldest when using the mail command.
maillastInstructs logrotate to mail the oldest log files instead of the just rotated ones when using the mail command.
ifemptyAllows log rotation even when the log files are empty
notifemptyInstructs logrotate not to rotate log files if they are empty.
create mode owner groupAfter log rotation, a new empty log file is created with the same file name as the rotated one. The owneris used to specify the username that owns the file, while the groupspecifies the group the log file would belong to.
nocreateNew files are not created after log rotation.
copyThis parameter makes a copy of a log file.
extension extThis states that log files with the specified extshould keep their extension.
tabooext extSets logrotate to prevent files with specified file extensions from being rotated.