Chinaunix首页 | 论坛 | 博客
  • 博客访问: 311562
  • 博文数量: 95
  • 博客积分: 3010
  • 博客等级: 中校
  • 技术积分: 840
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-01 13:05
文章分类

全部博文(95)

文章存档

2009年(8)

2008年(87)

我的朋友

分类: LINUX

2008-07-19 03:09:03

配置: squid: /etc/squid/squid.conf

代码:

logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %h" "%{User-Agent}>h" %Ss:%Sh %{host}>h

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的日志转为正常的日志。

阅读(1704) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~