Linux_rsylogd Log rotation (iii)

Source: Internet
Author: User
Tags apache log


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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.