apache 访问日志按周,天,小时轮循设置
apache 访问日志按周,天,小时轮循设置
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/data/www/bbs
ServerName www.test.com
ServerAlias www.dummy-host.example.com
# CustomLog "|/usr/local/sbin/cronolog /app/logs/access_%Y%m%d_www.log" combined
# CustomLog "|/usr/local/sbin/cronolog /app/logs/access_%w_www.log" combined
CustomLog "|/usr/local/sbin/cronolog /app/logs/access_%Y%m%d%H_www.log" combined
ErrorLog "/app/logs/error_www.log"
# ErrorLog "logs/dummy-host.example.com-error_log"
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
要点:
1.安装cronolog 工具
wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
tar -zvxf cronolog-1.6.2.tar.gz
cd cronolog-1.6.2
./configuer
make && make install
2.CustomLog "|/usr/local/sbin/cronolog /app/logs/access_%Y%m%d%H_www.log" combined
此处的日志路径,要使用绝对路径
备注:apache版本号是:2.2.29 centos5.8 64位
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。