数量核对不上啊?我写错了么?(iisLog分析 用的LogParser,sql语句和Sqlserver差不多)
时间:2011-12-21
来源:互联网
ip总数->
SQL code
结果->1865
//蜘蛛的ip总数
SQL code
结果->569
访客ip总量(代码和蜘蛛总量相似,只是将蜘蛛ip总量的sql语句中like前面加个not,同时or改成and),如下:
SQL code
结果->1304
问题来了,按道理结果应该是 ->【ip总量】 减掉 【蜘蛛的ip总量】,也就是1865-569=1296但是结果却是1304,怎么多出了8个?哪来的?希望高手帮忙想想...
SQL code
select COUNT(distinct c-ip) as GueCount from 'F:ex111001.log'
结果->1865
//蜘蛛的ip总数
SQL code
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),如下:
SQL code
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个?哪来的?希望高手帮忙想想...
作者: ximomomoxinei15 发布时间: 2011-12-21
完成代码(未整理..有点乱 但能看明白)->
C# code
C# code
LogQuery oLogQuery = new LogQuery(); IISInputFormat oIISInputFormat = new IISInputFormat(); DateTime dt1 = DateTime.Now; //ip总量 1865(包括蜘蛛) //string query = @"select COUNT(distinct c-ip) as GueCount from 'F:ex111001.log'"; //蜘蛛的ip个数 //string query = @"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%'"; //百度 string query = @"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%'"; LogRecordSet oRecordSet = oLogQuery.Execute(query, oIISInputFormat); if (!oRecordSet.atEnd()) { int guestCount = (int)oRecordSet.getRecord().getValue("GueCount"); DateTime dt2 = DateTime.Now; //MessageBox.Show("访客总量->" + guestCount + " |耗时" + (dt2 - dt1).ToString(),"提示"); } oRecordSet.close();
作者: ximomomoxinei15 发布时间: 2011-12-21
怎么木人?
作者: ximomomoxinei 发布时间: 2011-12-21
1304 应该是准确的
like or 可能会导致统计出错
like or 可能会导致统计出错
作者: Sandy945 发布时间: 2011-12-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28