centos安装很简单
yum install epel-release
yum install cronolog
然后配置虚拟主机
[root@bbs ~]# vim /opt/app/apache/conf/extra/httpd-vhosts.conf (虚拟主机配置文件)
#
#
<VirtualHost *:80>
ServerAdmin sadoc.blog.51cto.com
DocumentRoot "/var/www"
ServerName bbs.52cto.com
ServerAlias 52ctt.com
ErrorLog "logs/bbs-error_log"
#CustomLog "logs/bbs-access_log" common
#以下是日期轮询方法,选择一种删除其他。
#按天日志轮询,日志不会自动覆盖
CustomLog "|/usr/sbin/cronolog /var/log/httpd_acc%Y%m%d.log" combined
#按小时日志轮询,比较详细
CustomLog "|/usr/sbin/cronolog /var/log/httpd_acc%Y%m%d%H.log" combined
#按周日志轮询,日志会自动覆盖
CustomLog "|/usr/sbin/cronolog /var/log/httpd_acc%w.log" combined
#按周分目录日志轮询,日志会自动覆盖
CustomLog "|/usr/sbin/cronolog /var/log/%w/httpd_acc.log" combined
</VirtualHost>
Restart 服务
cat /var/log/...
转载于:https://blog.51cto.com/sadoc/1913529