分类: LINUX
2008-07-19 03:09:03
配置: squid: /etc/squid/squid.conf
代码: |
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs
% access_log /var/log/squid/access.log combined |
awstats: /etc/awstats/awstats.conf.local
代码: |
LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot %other %virtualname" LogFile="/var/log/squid/access.log" |
关键点: squid 的日志需要加上虚拟主机名: %{host}>h awstats的读取参数指出 %virtualname 还有一种方法,我觉得也是比较理想的,直接修改apache的日志格式:
原:
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
修改为:
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""combined
这样也可以将apache的日志转为正常的日志。