ip总数->select COUNT(distinct c-ip) as GueCount from 'F:ex111001.log'结果->1865//蜘蛛的ip总数    select COUNT(distinct c-ip) as GueCount from 'F:ex111001.log' where cs(User-Agent) like 
'%baidu%' or cs(User-Agent) like '%Yahoo!+Slurp%' or cs(User-Agent) like '%google%' or cs(User-Agent) like '%
YoudaoBot%' or cs(User-Agent) like '%sogou%' or cs(User-Agent) like '%msnbot%' or cs(User-Agent) like '%
+bingbot%'结果->569访客ip总量(代码和蜘蛛总量相似,只是将蜘蛛ip总量的sql语句中like前面加个not,同时or改成and),如下:select COUNT(distinct c-ip) as GueCount from 'F:ex111001.log' where cs(User-Agent) not like '%baidu%' and cs(User-Agent) not like '%Yahoo!+Slurp%' and cs(User-Agent) not like '%google%' and cs(User
-Agent) not like '%YoudaoBot%' and cs(User-Agent) not like '%sogou%' and cs(User-Agent) not like '%msnbot%' and cs(User-Agent) not like '%+bingbot%'  结果->1304问题来了,按道理结果应该是 ->【ip总量】 减掉 【蜘蛛的ip总量】,也就是1865-569=1296但是结果却是1304,怎么多出了8个?哪来的?希望高手帮忙想想...

解决方案 »

  1.   

    是不是有null值影响?把条件中的列判断一下是否为空,sql server的话,可以isnull()
      

  2.   

    不知道是MYSQL还是ORACLE还是什么。
      

  3.   

    不是数据库 是微软的一个可以分析iis日志的一个东西,支持sql语句..如果想让程序跑起来 前提是要装一个微软的Log Parser2.2.10,很小 1M多http://www.cnblogs.com/MaoBisheng/archive/2010/05/16/1736604.html
      

  4.   

    考虑过把log文件全部插入access中 但是有六万行 估计少说也得插个2分钟以上
    所以暂时就用这个直接读了 当然 如果需要导入数据库 我会选sqlserverl,因为SqlBulkCopy 时间上还是可以忍受的
      

  5.   

    or like
    and not like 
    不是减法用算,仔细考虑下。
      

  6.   

    我做了一个测试 and not like那条语句加了一个条件->jikespider
    log日志里面 cs(User-Agent) 列明明有jikespider这个值 但结果依然为1304,匪夷所思...
    我觉得做减法更准确 大家觉得呢?
      

  7.   

    先求出ip总量..
    再求出蜘蛛的ip总量
    最后做减法 得到的结果是不是更准确些?
    至于and not like..我还是有点想不通 但好像也能感觉出什么...  
      

  8.   

    而求蜘蛛ip总量里面加了jikespider的条件后 结果变为571(之前是569)..
    感觉做减法更加准确...