s %b \"%{Referer}i\" \"%{User-Agent}i\"\" combined LogFormat \"%h %l %u %t \"%r\" %>s %b\" common CustomLog \"/usr/logs/logs/access_log\" combined 然后,这样的话当前的虚拟主机的日志就会放到/usr/logs/">
摘要:首先,我是逐个对每个虚拟主机进行配置的,找到一个虚拟主机,添加如下内容 LogFormat \"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"\" combined LogFormat \"%h %l %u %t \"%r\" %>s %b\" common CustomLog \"/usr/logs/logs/access_log\" combined 然后,这样的话当前的虚拟主机的日志就会放到/usr/logs/
首先,我是逐个对每个虚拟主机进行配置的,找到一个虚拟主机,添加如下内容
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined LogFormat "%h %l %u %t "%r" %>s %b" common CustomLog "/usr/logs/logs/access_log" combined
然后,这样的话当前的虚拟主机的日志就会放到/usr/logs/logs/access_log
具体位置如下:
<VirtualHost *:80> ... LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined LogFormat "%h %l %u %t "%r" %>s %b" common CustomLog "/backup/logs/access_log" combined </VirtualHost>
如果要添加按照日期进行划分,如下请修改
(就是修改这一句:
CustomLog "/backup/logs/access_log" combined )
CustomLog "|/usr/local/apache/bin/rotatelogs /backup/logs/abc.%Y%m%d 86400" common
/usr/local/apache/ apache路径
/backup/logs 日志路径
abc 日志前缀
%Y%m%d 后缀格式
86400 分割时长
具体日志命名如下:abc.201309135
如下部分为啥会有俩,暂时搞不明白,应该下边的可以去掉,请高人指点
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined LogFormat "%h %l %u %t "%r" %>s %b" common
相关文章推荐
虚拟主机的专业参数,分别都是什么意思?2022-09-09
中非域名注册规则是怎样的?注册域名有什么用处? 2022-01-10
HostEase新年活动促销 美国/香港主机全场低至五折2021-12-28
HostGator下载完整备份教程分享2021-12-28
Flink中有界数据与无界数据的示例分析2021-12-28