Apache配置之日志切割

Apache配置之日志切割


为了避免产生巨大的日志文件,我们需要按每小时或者每天对日志进行归档

1.配置虚拟主机文件    #vim /usr/local/apache/conf/extra/httpd-vhosts.conf    将“EorrLog”"CustomLog"分别改为

ErrorLog "|/usr/local/apache/bin/rotatelogs(apache的切割工具) -l /usr/local/apache/logs/beibei-error_%Y%m%d.log 86400(一天86400秒)"

CustomLog "|/usr/local/apache/bin/rotatelogs -l /usr/local/apache/logs/beibei-access_%Y%m%d.log 86400" combined

2.重启Apache

(1)#/usr/local/apache/bin/apachectl -t

(2)#/usr/local/apache/bin/apachectl restart


本文出自 “XuQing之运维” 博客,转载请与作者联系!

你可能感兴趣的:(linux)