网站服务器日志记录了web服务器接收处理请求以及运行时错误等各种原始信息。通 过对日志进行统计、分析、综合,就能有效地掌握服务器的运行状况,发现和排除错误原 因、了解客户访问分布等,更好的加强系统的维护和管理。
对于自己有服务器的朋友或是有条件可以看到服务器日志文件的朋友来说,无疑是了 解搜索引擎工作原理和搜索引擎对网页抓取频率的最佳途径。
通过这个文件,您可以了解什么搜索引擎、什么时间、抓取了哪些页面,以及可以知 道是主搜索蜘蛛还是从搜索蜘蛛抓取了您的网站等的信息。
访问原理
1、客户端(浏览器)和Web服务器建立TCP连接,连接建立以后,向Web服务器发出 访问请求(如:Get),根据HTTP协议该请求中包含了客户端的IP地址、浏览器类型、 请求的URL等一系列信息。
2、Web服务器收到请求后,将客户端要求的页面内容返回到客户端。如果出现错误,那么返回错误代码。
3、服务器端将访问信息和错误信息纪录到日志文件里。
查看服务器IIS服务器日志是在Windows文件夹.>>>>system32>>LogFiles>>W3SVC1下的.Log文件
#Software: Microsoft Internet Information Services 6.0
  #Version: 1.0
  #Date: 2006-05-12 03:56:30
   #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
  2006-05-12 03:56:30 ************** 218.25.92.169 GET / - 80 - 220.181.18.98 Baiduspider+(+http://www.baidu.com/search/spider.htm) 403 14 5
  /* 说明 */
  上面定义了在2006年5月12日的3点56分30秒的时候,IP为220.181.18.98的百度蜘蛛通过80端口(HTTP)访问了IP为218.25.92.169的服务器的根目录,但被拒绝。
  #Software: Microsoft Internet Information Services 6.0
  #Version: 1.0
  #Date: 2006-05-12 10:18:39
   #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
  2006-05-12 10:33:36 ************** 218.25.92.169 GET /***/index.htm - 80 - 10.2.57.6 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1) 200 0 0
   2006-05-12 10:33:36 ************** 218.25.92.169 GET /***/***/***.gif - 80 - 10.2.57.6 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1) 200 0 0
  /* 说明 */
  上面定义了在2006年5月12日的10点33分36秒的时候,IP为10.2.57.6的用户正常访问了网站**************中***目录下的index.htm页和***/***下的***。gif图片。
  #Software: Microsoft Internet Information Services 6.0
  #Version: 1.0
  #Date: 2006-05-12 13:17:46
   #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
  2006-05-12 13:17:46 ************** 218.25.92.169 GET /robots.txt - 80 - 66.249.66.72 Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html) 404 0 2
  2006-05-12 13:17:46 ************** 218.25.92.169 GET / - 80 - 66.249.66.72 Mozilla/5.0+(compatible;+Googlebot/2.1;++http://www.google.com/bot.html) 403 14 5
  /* 说明 */
  上面定义了在2006年5月12日的13点17分46秒的时候,IP为66.249.66.72的Google蜘蛛访问了robots.txt文件,但没有找到此文件,有访问了此网站的根目 录,但被拒绝。
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 sc-bytes
日期时间 站点名 服务IP 访问方法 URI资源 URI查询 服务器端口 用户名 客户IP 用户代理 协议状态 协议子状态 Win32状态 发送的字节数
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