Restrict Apache log access. log File Size

Source: Internet
Author: User
Tags apache log

Restrict Apache log access. log File Size

Rotatelogs is a simple program used with the Apache pipeline log function. You can configure the rotatelogs function of the Apache program in the httpd. conf configuration file of apache.

References: here

1. generate new logs every day

CustomLog "|/usr/sbin/rotatelogs/etc/httpd/logs/access_log _ % Y-% m-% d 86400 480" combined

2. Logs exceeding a certain size generate new logs

CustomLog "|/usr/sbin/rotatelogs/etc/httpd/logs/access_log _ % Y-% m-% d 5 M" combined

3 rotatelogs syntax

Rotatelogs [-l] logfile [rotationtime [offset] | [filesizeM]
Logfile. the benchmark name is the log file name. If logfile contains "%", it will be considered as a string in strftime () format; otherwise, it will be automatically added with the suffix ". nnnnnnnnnn" in seconds. Both formats indicate the start time of the new log. The interval in seconds when the rotationtime log file is rolled. The minute of the time difference between offset and UTC. If it is omitted, it is assumed that it is "0" and UTC time is used. For example, to specify the local time of the region with the UTC time difference of-5 hours, this parameter should be "-300 ". FilesizeM specifies to scroll by filesizeM file size, rather than by time or time difference. An example of setting in Windows is as follows:
# Restrict the error log file to 1 MB
ErrorLog "| bin/rotatelogs.exe-l logs/error-% Y-% m-% d. log 1 M"
# Generate an error log file every day
# ErrorLog "| bin/rotatelogs.exe logs/error-% Y-% m-% d. log 86400"
# Restrict access log files to 1 MB
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 logs/access-% Y-% m-% d. log 86400" common

------------------------------------- I am a split line -------------------------------------

How to enable Apache Rewrite in Ubuntu

Key points after upgrading Apache 14.04 to 2.2 in Ubuntu 2.4

Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04

Compile and install LAMP in CentOS 5.9 (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12)

Source code for Web server architecture in RedHat 5.4 build the LAMP environment and application PHPWind

Build a WEB Server Linux + Apache + MySQL + PHP in the LAMP source code Environment

-------------------------------------- Split line --------------------------------------

Apache details: click here
Apache: click here

This article permanently updates the link address:

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.