Lamp-apache Log Cutting

Source: Internet
Author: User
Tags apache log

The site will increase with the amount of traffic, and the log becomes more and more large, if ignored, will someday burst disk.

So we should cut the log regularly every day, such as one months later, and then delete the outdated logs to ensure that the log files will not be an infinite amount of disk-occupying resources.


configuration: to enter Apache virtual Host configuration file, modify Errorlog & Customelog Two lines of fields, using the Bin directory rotatelogs execution file for cutting


<virtualhost *:80>

DocumentRoot "/data/www"

ServerName www.test.com

Serveralias www.aaa.com www.bbb.com www.ccc.com

errorlog "Logs/test.com-error_log"

Customlog "|/usr/local/apache/bin/rotatelogs-l/usr/local/apache/logs/test.com-access_%y%m%d_log 86400" combined


Description: %y%m%d definition logs are named according to the date of day , 86400 refers to 86,400 seconds (one day) before cutting

The combined represents the format of the log, which can be viewed in the httpd.conf configuration file.

<ifmodule log_config_module>

#

# The following directives define some format nicknames for use with

# a Customlog directive (see below).

#

Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" combined

Logformat "%h%l%u%t \"%r\ "%>s%b" Common


This article is from the "Parody Games" blog, so be sure to keep this source http://kevinjin117.blog.51cto.com/11655131/1835138

Lamp-apache Log Cutting

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.