Ways to limit the size of Apache log files _linux

Source: Internet
Author: User
Tags apache log
Normally we set Apache parameters in {$apache}/conf/httpd.conf, but we did not find any configuration instructions to set the log file size by reference http://httpd.apache.org/docs/2.0/ Programs/rotatelogs.html, you can use Apache's own program Rotatelogs.exe (located in {$apache}/bin/directory) to limit the size of the log file.
Usage:rotatelogs [-l] [offset minutes from UTC] or
ADD this:
Transferlog "|rotatelogs/some/where 86400"
Or
Transferlog "|rotatelogs/some/where 5M"
To httpd.conf. The generated name would be/some/where.nnnn where nnnn is the system time at which the log nominally starts (n.b. If using A rotation time, the time would always be a multiple of the rotation time, so you can synchronizecron scripts with it. At the ' end ' of each rotation time or when the ' file size is ' reached a new log is started.
Examples of settings under Windows are as follows:
# Limit error log file to 1M
ErrorLog "|bin/rotatelogs.exe-l logs/error-%y-%m-%d.log 1M"
# Generate an error log file every day
#ErrorLog "|bin/rotatelogs.exe-l logs/error-%y-%m-%d.log 86400"
# Restrict access log files to 1M
Customlog "|bin/rotatelogs.exe-l logs/access-%y-%m-%d.log 1M" common
# Generate an Access log file every day
#CustomLog "|bin/rotatelogs.exe-l logs/access-%y-%m-%d.log 86400" common
The Linux/unix should be similar.
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.