标题:
[求助]
如何更改APACHE日志的格式?
[打印本页]
作者:
tiantangld
时间:
2012-6-9 12:13
标题:
如何更改APACHE日志的格式?
近日想更改APACHE日志的格式,使其能记录访客的User-Agent信息到日志里,但是百度了很多资料,还是没能学会
现在的日志记录下来是这样:
10.1.1.95 - e800 [18/Mar/2005:12:21:42 +0800] "GET /stats/awstats.pl?config=e800 HTTP/1.1" 200 899
复制代码
我想改成这样:
10.1.1.95 - e800 [18/Mar/2005:12:21:42 +0800] "GET /stats/awstats.pl?config=e800 HTTP/1.1" 200 899 "http://10.1.1.1/pv/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon)"
复制代码
哪位大哥知道怎么修改呢?
以下为小弟http.conf的部分信息,不知道是不是改这里?
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" common
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
复制代码
作者:
admin
时间:
2012-6-9 15:37
CustomLog "logs/access_log" common
改为
CustomLog "logs/access_log" combined
就可以
作者:
tiantangld
时间:
2012-6-9 18:32
回复
2#
admin
非常感谢
作者:
tiantangld
时间:
2012-6-9 23:29
回复
2#
admin
老大,我试着更改重启了还是不行哦,是不是我改错哪里了,麻烦老大帮忙在看一下
我更改后,日志还是这样子的
95.211.139.1 - - [09/Jun/2012:23:16:04 +0800] "GET /store/shoplist-14.html HTTP/1.0" 200 -
复制代码
最后附httpd.conf
<IfModule log_config_module>
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog "logs/access_log" combined
#
# If you prefer a logfile with access, agent, and referer information
# (Combined Logfile Format) you can use the following directive.
#
#CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
复制代码
作者:
admin
时间:
2012-6-10 00:36
这样是对的
作者:
tiantangld
时间:
2012-6-10 01:38
回复
5#
admin
终于找到问题所在了,单单修改这里还不行,还要去修改虚拟主机配置文件
作者:
admin
时间:
2012-6-10 10:36
这个是默认的记录文件,也是所有的
虚拟主机里的是针对站点的
欢迎光临 WDlinux官方论坛 (http://wdlinux.cn/bbs/)
Powered by Discuz! 7.2