One, Cronolog
Download Ronolog Package: wget-p/usr/lcoal http://cronolog.org/download/cronolog-1.6.2.tar.gz
1,install:
Cd/usr/local && Tar XF cronolog-1.6.2.tar.gz && cd cronolog-1.6.2 &&/configure && make && make Install
2, configure httpd.conf
[Tangzhengchao@aliyun-live2 conf]$ Vim httpd.conf
Search for keywords find location modifications
278 ErrorLog "|/usr/local/sbin/cronolog/alidata/server/httpd/logs/error_%w.log"
307 Customlog "|/usr/local/sbin/cronolog/alidata/server/httpd/logs/access_%w.log" combined
The logs are stored under/alidata/server/httpd/logs/, named after the Access_ and Error_, at the end of%w.log, and the%w represents a day of 0-6, from the start calculation, has been polling
[Tangzhengchao@aliyun-live2 vhosts]$ ll/alidata/server/httpd/logs/
Total 480
-rw-r--r--1 root root 1203 Mar 17:29 Error_3.log
3, configure dl.16889999.com.conf
[tangzhengchao@aliyun-live2 vhosts]$ vim dl.16889999.com.conf
errorlog |/usr/local/sbin/cronolog /alidata/log/httpd/dl.16889999.com-error-%w.log "
Customlog" |/usr/local/sbin/cronolog/alidata/log/ Httpd/dl.16889999.com-access-%w.log "Vhost_common env=!dontlog
[tangzhengchao@aliyun-live2 vhosts]$ ll/alidata/ log/httpd/dl.16889999.com*
-rw-r--r--1 root root 165445 Mar 23:59/alidata/log/httpd/ Dl.16889999.com-access-3.log
-rw-r--r--1 root root 266742 Mar 10:39/alidata/log/httpd/ Dl.16889999.com-access-4.log
4, configure [Tangzhengchao@aliyun-live2 logs]$ vim ... /conf/vhosts/jds.jince.com.conf
ErrorLog "|/usr/local/sbin/cronolog/alidata/log/httpd/jds.jince.com-error-%w.log"
Customlog "|/usr/local/sbin/cronolog/alidata/log/httpd/jds.jince.com-access-%w.log" Vhost_common Env=!dontlog
[Tangzhengchao@aliyun-live2 vhosts]$ ll/alidata/log/httpd/
Total 69996
-rw-r--r--1 root root 57273 Mar 17:37 jds.jince.com-access-3.log
-rw-r--r--1 root 38541 10:56 jds.jince.com-access-4.log
Cronolog configuration:
After the Ronolog installation is complete, the default/usr/local/sbin/cronolog
In $apache.conf (or vhosts configuration file)
Error Log "|cronolog location/log store path%w cycle. Log
ErrorLog "|/usr/local/sbin/cronolog/alidata/server/httpd/logs/error%w.log"
Access Log "|cronolog location/log store path%w cycle. Log combined end
Customlog "|/usr/local/sbin/cronolog/alidata/server/httpd/logs/access%w.log" combined
When the settings are complete, the log is automatically split from the date form (daily). such as: Access_0.log, until the end of Access_6.log, the next cycle is rotation cover, only keep the latest 7 days log!
Two: Rotatelogs Division
Find Rotatelogs Position
[Root@localhost local]# Find/-name rotatelogs
/usr/sbin/rotatelogs
Modify configuration file
ErrorLog "| /usr/sbin/rotatelogs/var/log/httpd/error_%y%m%d.log 86400 480 "
Customlog "| /usr/sbin/rotatelogs/var/log/httpd/access_%y%m%d.log 86400 "Common
86,400:86,400 represents a day, that is, a new log file is generated on a daily basis.
480: The number of minutes of time difference relative to UTC. If omitted, the default is 0, and UTC time is used. For example, to specify local time for a region that has a UTC difference of 5 hours, this should be-300, Beijing time is +8, and should be set to 480. So the time in the log will be consistent with the time on the server, easy to view the log.