Logrotate references
References for Logrotate.
Parameters | Description |
---|---|
rotate count | Sets log files to rotated for a specified amount of time (counts) before they are mailed or deleted. |
compress | Compresses rotated log files with the default .gzip format. |
nocompress | Old log files are not compressed. |
delaycompress | Sets compression of preceding logs to be delayed till after the next rotation. |
nodelaycompress | Compression of rotated log files are not delayed. |
daily | Sets log rotation to occur daily. This is usually at the first hour of the day. |
weekly | Sets log rotation of log files to occur weekly. It usually happens on the first day of the week. |
monthly | Rotates log files once a month. This is usually in the first day logrotate runs in a month. |
yearly | Sets log rotation to occur once a year. This is usually at the beginning of the year. |
size size | Sets logs to be rotated once they reach a specified size. |
minsize size | Log 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 count | Sets legrotate to remove rotated files older than the specified count. The counts is recorded in days. |
prerotate +
endscript | The script or command given between the "prerotate and endscript" are executed before rotating the log files. |
postrotate +
endscript | The script or command given between the "postrotate and endscript" are executed after log rotation. |
dateext | Rotated log files would have a date extension after the file name. |
nodateext | No date extension would be displayed. |
dateformat format_string | This displays the file date extension in a specified format. For example,
YYMMDD , this would be set using
-%Y%M%D . |
olddir directory | Log files are moved to the specified directory for rotation. |
missingok | Instructs logrotate to display no error when a log file is missing |
nomissingok | When a log file is missing during rotation, an error should be displayed. |
shred | Enables 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. |
noshred | No use of
shred to delete files. |
shredcycles count | overrides log files a number of specified times before they are deleted. |
mail | Send rotated log files to a specified email address. |
mailfirst | Instructs logrotate to mail the recently rotated logs rather than the oldest when using the
mail command. |
maillast | Instructs logrotate to mail the oldest log files instead of the just rotated ones when using the
mail command. |
ifempty | Allows log rotation even when the log files are empty |
notifempty | Instructs logrotate not to rotate log files if they are empty. |
create mode owner group | After 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. |
nocreate | New files are not created after log rotation. |
copy | This parameter makes a copy of a log file. |
extension ext | This states that log files with the specified extshould keep their extension. |
tabooext ext | Sets logrotate to prevent files with specified file extensions from being rotated. |