LogRotate
0. Introduction
Section titled “0. Introduction”LogRotate is a log management tool, which enables log files’ cutting, deleting and creating, and triggered by crontab.
1. Configuration Files and Path
Section titled “1. Configuration Files and Path”The default config file located/etc/logrotate.conf
In default config file, the config folder/etc/logrotate.dis included by default. Which means, config files added in this folder will be executed by logrotate process.
2. Config demo
Section titled “2. Config demo”/var/log/***.log { # The target log file LOG_CONFIG_PARAMETERS # The parameters for logrotate}3. Supported Parameters
Section titled “3. Supported Parameters”(1). Cutting cycle
Section titled “(1). Cutting cycle”- daily: The cutting cycle is daily
- weekly: The cutting cycle is weekly
- monthly: The cutting cycle is monthly
- yearly: The cutting cycle is every year
(2). Dump size
Section titled “(2). Dump size”- size 50M
(3). Number of copies of log saved
Section titled “(3). Number of copies of log saved”- rotate 1
(4). Number of days to retain logs
Section titled “(4). Number of days to retain logs”- maxage 1
(5). Do not dump files with specified extensions
Section titled “(5). Do not dump files with specified extensions”- tabooext [+] list
(6). Ignore errors
Section titled “(6). Ignore errors”- missingok
(7). Backup/truncation
Section titled “(7). Backup/truncation”- copytruncate/nocopytruncate
(8). Create permissions
Section titled “(8). Create permissions”- create mode owner group
- nocreate
(9). Compression
Section titled “(9). Compression”- nocompress
- compress
(10). Delay compression
Section titled “(10). Delay compression”- delaycompress
- nodelaycompress
(11). Execute before all other instructions are completed
Section titled “(11). Execute before all other instructions are completed”- prerotate
- endscript
(12). Execute after all other instructions are completed
Section titled “(12). Execute after all other instructions are completed”- postrotate
- endscript
(13). Shared scripts
Section titled “(13). Shared scripts”- sharedscripts
(14). The error message is sent to the specified email address
Section titled “(14). The error message is sent to the specified email address”- errors address
(15). Send the dumped log file to the specified E-mail address
Section titled “(15). Send the dumped log file to the specified E-mail address”- mail address
- nomail
(16). Empty files are also dumped
Section titled “(16). Empty files are also dumped”- ifempty
- notifempty
(17). Specify the dump directory
Section titled “(17). Specify the dump directory”- olddir directory
- noolddir
(18). Log date suffix
Section titled “(18). Log date suffix”- dateext
(19). Log format
Section titled “(19). Log format”- dateformat
(20). Date one day in advance
Section titled “(20). Date one day in advance”- dateyesterday
(21). Specify the suffix of the file
Section titled “(21). Specify the suffix of the file”- extension
[1]. https://blog.csdn.net/xiaojin21cen/article/details/122309230