Rotation of the log
1. Naming rules for log files
A. If the configuration file has the "dateext" parameter, then the log will use the date as the suffix of the log file, for example: "secure-20150630". So the log files do not overlap, so you do not need to rename the log file, just to save the specified number of logs, Delete the extra log files.
B. If there is no "dateext" parameter in the configuration file, the log file needs to be renamed, and when the first log rotation is made, the current "secure" log is automatically renamed "Secure.1" and a new "secure" log is used to record the new log. When the second rotation occurs, the "Secure.1" is automatically renamed as "Secure.2", the current log is automatically renamed to Secure.1, and a new secure log file is created to record the new log and so on. (This has an efficiency without the high of a method)
2.logrotate configuration file/etc/logrotate.conf
File Description:
The rotation cycle for daily logs is daily
The rotation cycle for weekly logs is weekly
The rotation cycle for monthly logs is monthly
Adding logrotate to the Apache source package for polling logs
Linux Server Management: Log management (II)