How to solve the problem of Apache log file too big

Source: Internet
Author: User
Tags apache log file log log apache log

Original address: http://un173.blog.51cto.com/8263566/1598346

Manage Apache server For some years, though Nginx has been robbed of many thunder in recent years, I still love Apache.

Like its powerful concurrent processing power, and the free choice between forker and the worker mode of pleasure, haha.

Familiar with the Linux Apache operation of the friends, how many will encounter the Apache log file is too large problems, the site just online will not care about this problem, because the traffic is small, Natural Error.log and Access.log file content is also small, file capacity is small, therefore, the configuration will not consider what the Apache log maintenance strategy what.

When website traffic goes up to a certain level, a single error.log or access.log will not be able to cope with the growing log files and the need for log analysis.

The idea is to limit the size of the file, and then roll back, which is often said Apache log segmentation and round-robin.

How to solve this problem correctly, there are many articles on the net, here to tidy up a few, stay as a memo.

    • 1, correctly solve the Apache log file too big problem

    • 2. Solve the Apache log file too big problem (split Apache log by day)

    • 3, Apache Error.log log file too big how to do?

    • 4, Apache access.log log file too big how to do

    • 5, Apache log file is too large how to use the log rolling resolution?

    • 6, Apache log file is too large how to do log round?

I refer to the above information, completed the Apache log parts of the rollback operation, each log file is limited to the specified size, and then generate log files by day, observed a period of time, the effect is good.

The following is a description of the configuration of my Apache log rollback:

Default configuration:

12 CustomLog "logs/access.log" commonErrorLog "logs/error.log"

The modified configuration:

123 CustomLog "|bin/rotatelogs /var/logs/logfile 86400" commonCustomLog "|bin/rotatelogs /var/logs/logfile 5M" commonErrorLog "|bin/rotatelogs /var/logs/errorlog.%Y-%m-%d-%H_%M_%S 5M"

Example 2:

12345678 # 限制错误日志文件为 1MErrorLog “|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 1M”# 每天生成一个错误日志文件#ErrorLog “|bin/rotatelogs.exe -l logs/error-%Y-%m-%d.log 86400″# 限制访问日志文件为 1MCustomLog “|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 1M” common# 每天生成一个访问日志文件#CustomLog “|bin/rotatelogs.exe -l logs/access-%Y-%m-%d.log 86400″ common


If you also encounter the Apache log file growth too fast, log file too large problem, may wish to try.

The method is very simple and the effect is obvious.

How to solve the problem of Apache log file too big

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.