'/*=========================================================================
' * Intro iis日志搜索引擎相关访问次数统计vbs版,把这个文件存为:iislogAnalyzer.vbs,然后直接运行输入日志目录或把要统计的日志拖到这个文件上,程序会自动处理,日志比较大时处理会比较慢
' * FileName iislogAnalyzer.vbs
' * Author yongfa365
' * Version v2.0
' * WEB http://www.yongfa365.com
' * Email yongfa365[at]qq.com
' * FirstWrite http://www.yongfa365.com/Item/iis-log-Analyzer-vbs.html
' * CreateTime 2007-6-18 12:53:12
' * LastModify 2007-12-12 12:53:12
' *==========================================================================*/
If WScript.Arguments.length<1 Then
File =InputBox("请输入日志路径")
If File<>"" Then CheckSearchNO(File)
Else
For Each File In WScript.Arguments
CheckSearchNO(File)
Next
End If
Function ReadFile(Filename)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set cnt = FSO.OpenTextFile(Filename, 1, True)
ReadFile = cnt.ReadAll
End Function
Function RegExpTest(patrn, strng)
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(strng)
RegExpTest = Matches.Count
End Function
Function CheckSearchNO(File)
bots = "Baiduspider|Googlebot|yahoo|msnbot|sogou|YodaoBot|iaskspider|Qihoo|soso|bsalsa"
bots = Split(bots, "|")
title_temp=Split(File,"\")
title=title_temp(UBound(title_temp)) & vbCrLf & vbCrLf
x=""
For i = LBound(bots) To UBound(bots)
x = x & bots(i) & ":" & RegExpTest(bots(i),ReadFile(File)) & vbCrLf & vbCrLf
Next
Call MsgBox(x,,title&"统计结果")
End Function