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位

你可能感兴趣的:(apache,访问日志轮循设置)