IIS 日志文件分析

先安装下文参考资料中的log parser studio

然后就可以针对日志文件进行sql语句的查询了.

 

各页面访问量排行

SELECT cs-uri-stem,count(1)
FROM '[LOGFILEPATH]' 
where cs-uri-stem not like '%.js%' and cs-uri-stem not like '%.css%'
and cs-uri-stem not like '%.gif%'
and cs-uri-stem not like '%.png%'
and cs-uri-stem not like '%.jpg%'
and cs-uri-stem not like '%.ico%'
and cs-uri-stem not like '%.axd%'
group by cs-uri-stem
order by count(1) desc

 

下面列出日志格式中各字段的含义:

Fields:
 

date 2010-07-30 \\爬行日期
time 01:06:43 \\时间
s-sitename W3SVC1 \\服务器名称
s-computername MGL \\ 网站名称
s-ip 192.168.0.102 \\网站IP
cs-method GET \\获取方法
cs-uri-stem /css/rss.xslt \\文件的URL
cs-uri-query - \\?后面的参数
s-port 80 \\服务器端口
cs-username - \\用户名
c-ip 192.168.0.102 \访问者(蜘蛛)ip
cs-version HTTP/1.1 \\协议版本
cs(User-Agent) Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+Trident/4.0;+InfoPath.2;+360SE)
\\用户代理,即用户所用的浏览器(这个最重要)
cs(Cookie) ASPSESSIONIDACRRDABA=IDDHCBBBHBMBODAGCIDKAGLM \\发送或接收的 Cookie 内容(如果有)
cs(Referer) - \\选择该选项可以记录用户访问的前一个站点。此站点提供与当前站点的链接。
cs-host 192.168.0.102 \\主机头的内容。我本地访问的是IP,这个应该是网站域名。
sc-status 304 \\协议状态(200是正常的 404 是找不到文件,304未改变。更多请查看IIS返回日志详解)
sc-substatus 0 \\协议子状态
sc-win32-status 0 \\win32状态
sc-bytes 140 \\发送的字节数
cs-bytes 358 \\接受的字节数
time-taken 0 \\所用时间
200 0 0 4600 316 140返回200正常,4600发送的字节数,316接受的字节数 140所用时间。这个时间应该是毫秒级别的。

 

参考资料:

http://www.cnblogs.com/dudu/p/3689384.html

http://baike.baidu.com/link?url=w4ILHBHeSljgPVa6mK4VWi5wmjmDYgNFG7ffOGChRpxUlfwHPPSjPrOy-lLwy6OWzjXpI8etKuLNoWKDuyCc2K

posted on 2015-01-28 13:28  隨風.NET  阅读(577)  评论(0编辑  收藏  举报

导航