linux 下用 cronolog 切割 apache日誌

cronolog安装可见http://simon-zzm.blog.163.com/blog/static/88809522201022112040647/

apache安装位置:/usr/local/apache/

编辑配置文件httpd.conf

LogFormat “%v %h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i”” mylog
LogFormat “%h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i”” combined
LogFormat “%h %l %u %t “%r” %>s %b” common


LogFormat “%h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i” %I %O” combinedio

CustomLog “|/usr/local/sbin/cronolog /usr/local/apache/logs/access.%Y%m%d-%H.log” combined

如果使用虚拟机可以使用以下配置

httpd-vhosts.conf

ErrorLog “|/usr/local/sbin/cronolog /usr/local/apache/logs/access.%Y%m%d-%H.log”
CustomLog “|/usr/local/sbin/cronolog /usr/local/apache/logs/access.%Y%m%d-%H.log” common

发表评论

电子邮件地址不会被公开。 必填项已用*标注