first, rotation rules and configuration files:vi/etc/logrotate.conf 1, if the configuration file has "Dateext" parameter, then the log will use the date as the suffix of the log file, such as "secure-20130605". In this case, the log file name does not overlap, so there is no need to rename the log files, just save the specified number of logs, delete the extra log files. 2, if there is no "dateext" parameter in the configuration file, then the log file needs to be renamed. When the first log rotation occurs, the current "secure" log is automatically renamed "Secure.1" and a new "secure" log is used to save the new log. When the second log rotation, "Secure.1" is automatically renamed "Secure.2", the current "secure" log is automatically renamed "Secure.1", and then a new "secure" log to save the new log, and so on.
Second,
/etc/logrotate.conf configuration file Description
third, the Apache log to join the rotation (if it is Yum installed, the default is to use the rotation, not separate settings; If the source is installed, you need to configure rotation)vi/etc/logrotate.conf
/usr/local/apache/logs/access_log {
daily create rotate
}
iv. logrotate Commandlogrotate [Options] Profile Name option: If this command does not have an option, the log rotation is followed by the criteria in the configuration file-V: Displays the log rotation process. With the-v option, the rotation of the log is displayed logrotate-v/etc/logrotate.conf-f: Force log rotation. Forces all the logs in the configuration file to be logrotate-f, regardless of whether the log rotation condition has been met/etc/logrotate.conf
From for notes (Wiz)
Linux_rsylogd Log rotation (iii)