Apache limits the size of log files

Source: Internet
Author: User

Apache limits the size of log files. Even if a server is not busy, the log file contains a large amount of information. Generally, access logs are increased by 1 MB or more for every 10000 requests. In this case, it is necessary to regularly scroll log files. Introduction to pipeline logs: www.2cto.com Apache httpd can pass access records and error information to another process through pipelines, rather than writing a file, because you do not need to program the master server, this feature significantly enhances log flexibility. You only need to use the pipeline operator "|" followed by an executable file name to obtain event records from the standard input device. Apache starts the pipeline log process at the same time, and restarts the process if the process crashes during running. An important use of pipeline logs is to allow log scrolling without restarting the server. To this end, the server provides a simple program rotatelogs. An example of rolling logs every 24 hours is as follows: CustomLog "|/usr/local/apache/bin/rotatelogs/var/log/access_log 86400" common the specific method is to open httpd of Apache. conf configuration file and find the following two configurations: www.2cto.com ErrorLog logs/error. log CustomLog logs/access. log common is directly commented out and replaced with the following configuration file. # Restrict the error log file to 1 M ErrorLog "| bin/rotatelogs.exe-l logs/error-% Y-% m-% d. log 1 MB "# generate an error log file every day # ErrorLog" | bin/rotatelogs.exe-l logs/error-% Y-% m-% d. log 86400 "# Restrict access log files to 1 M CustomLog" | bin/rotatelogs.exe-l logs/access-% Y-% m-% d. log 1 m "common # generate an access log file every day # CustomLog" | bin/rotatelogs.exe-l logs/access-% Y-% m-% d. log 86400 "common does not need to worry about the size of a single log file.

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.