Linux Server Management: Log management (II)

Source: Internet
Author: User

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)

Related Article

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.