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