My Space

导航

IIS服务器日志分析详解(转)

  查看服务器IIS服务器日志是在Windows文件夹.>>>>system32>>LogFiles>>W3SVC1下的.Log文件
  打开一个IIS的日志,我们在最上边大约第三行能够看到一个表头,像这样:
  #Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status
  这是日志每行中每个字段的名称,我们看到的"200 0 64"是最后3个,那就是
  sc-status sc-substatus sc-win32-status 这三个了,来看看这三个是什么东西:
  sc-status:
  HTTP协议的状态.HTTP协议的状态代码为200,这个可能大家不熟悉,但是,HTTP404找不到文件,HTTP500内部服务器错误,这两个状态代码大家应该很熟悉了吧? 不错,这个200,其实就是这个的一种,HTTP200就是文件被正常的访问了,只有这个数字是200以外的数字,才说明访问出现了错误(比如上面说的404文件找不到等).
  sc-substatus:
  HTTP子协议的状态.一般来说网站都是不使用子协议的,所以这个代码为0就是很正常的,我们完全可以不用管它.
  sc-win32-status:
  Win32状态.这只是表示客户端是否为32位系统的代码.如果被32位的系统访问,那么这里记录的就是0,如果被64位系统访问,那么这里记录的就是64……

        比如说:
        2007-12-03 07:33:25 61.135.145.208 - *.*.*.* 80 GET /index/119.htm - 304 Baiduspider+ (+http://www.baidu.com/search/spider.htm) 
        这就意味着百度蜘蛛在2007-12-03 07:33:25爬过/index/119.htm这一页,它发现这页是没有更新过的。

        再比如说:2007-12-03 07:33:25 61.135.145.208 - *.*.*.* 80 GET /index/120.htm - Googlebot/2.1 (http://www.google.com/bot.html
        这就意味着Google蜘蛛在2007-12-03 07:33:25爬过/index/119.htm这一页,它发现这页是新的,并全部爬完。

        下面我们针对IIS服务器日志分析个例子:
        #Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status sc-bytes 
        2007-11-17 16:02:09 W3SVC999 211.155.23.176 GET /b2b_cplist.asp catid=300 80 - 61.135.162.212 Baiduspider+ (+http://www.baidu.com/search/spider.htm) http://www.supidea.com 200 0 0 47806

        IIS Log参数详解

  • date(日期)    2007-11-17
  • time(时间)    16:02:09
  • cs-method(方法)   GET
  • cs-uri-stem(URI资源) /b2b_cplist.asp //代表访问的资源是当前这个文件
  • cs-uri-query(URI查询) catid=30 // 具体的访问参数
  • (cs-uri-stem+ cs-uri-query=实际访问的文件:/b2b_cplist.asp? catid=30)
  • s-port(服务器端口)  80
  • c-ip(客户端IP)   211.155.23.176(实际是网站所在服务器的IP)
  • cs(User-Agent)  Baiduspider+(+http://www.baidu.com/search/spider.htm) //百度在收录你呢J
  • cs(Referer) (引用站点) http://www.supidea.com//搜索的站点
  • sc-status(协议状态)  200 //200表示OK
  • sc-substatus(协议子状态) 0
  • sc-win32-status(Win32状态) 0
  • sc-bytes(发送的字节数)  1329 //表示当前文件的大小
  • 日期 date
  • 时间 time
  • 客户IP地址 c-ip
  • 用户名 cs-username
  • 方法 cs-method
  • URI资源 cs-uri-stem
  • 协议状态 sc-status
  • 发送字节数 sc-bytes
  • 协议版本 cs-version
  • 用户代理 cs(User-Agent)
  • 参照 cs(Referer)


        HTTP协议状态码的含义,协议状态sc-status,是服务器日记扩展属性的一项。下面是各状态码含义列表:

  • "100" : Continue
  • "101" : witching Protocols
  • "200" : OK
  • "201" : Created
  • "202" : Accepted
  • "203" : Non-Authoritative Information
  • "204" : No Content
  • "205" : Reset Content
  • "206" : Partial Content
  • "300" : Multiple Choices
  • "301" : Moved Permanently
  • "302" : Found
  • "303" : See Other
  • "304" : Not Modified
  • "305" : Use Proxy
  • "307" : Temporary Redirect
  • "400" : Bad Request
  • "401" : Unauthorized
  • "402" : Payment Required
  • "403" : Forbidden
  • "404" : Not Found
  • "405" : Method Not Allowed
  • "406" : Not Acceptable
  • "407" : Proxy Authentication Required
  • "408" : Request Time-out
  • "409" : Conflict
  • "410" : Gone
  • "411" : Length Required
  • "412" : Precondition Failed
  • "413" : Request Entity Too Large
  • "414" : Request-URI Too Large
  • "415" : Unsupported Media Type
  • "416" : Requested range not satisfiable
  • "417" : Expectation Failed
  • "500" : Internal Server Error
  • "501" : Not Implemented
  • "502" : Bad Gateway
  • "503" : Service Unavailable "504" : Gateway Time-out
  • "505" : HTTP Version not supported

posted on 2010-11-12 16:42  alronzhang  阅读(717)  评论(0编辑  收藏  举报