Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VBSCRIPT HELP WITH PARSING IIS LOG FILE

$
0
0

Hi Scripting Guru's

Please can anyone help me. I am using this VBscript to count the number of entries for "default.aspx" within my  IIS log files.

Dim oFso, oReg, sData, lCount
Const ForReading = 1, sPath = "C:\ex130725.log"
Set oReg = New RegExp
Set oFso = CreateObject("Scripting.FileSystemObject")
sData = oFso.OpenTextFile(sPath, ForReading).ReadAll
With oReg
    .Global = True
    .Pattern = "default.aspx" 'vbCrLf
    '.Pattern = "\n" ' vbLf, UTF-8 encoded text file?
    lCount = .Execute(sData).Count + 1
End With
WScript.Echo lCount
Set oFso = Nothing
Set oReg = Nothing

Each line in the log starts with the date/time entry "2013-07-25 00:23:25". I only wish to count and return the .Pattern search string that are found within a given date and time period. IE: 2013-07-25 14:23:25 to 2013-07-25 15:10:25.

Does anyone know of a way to do this - Thanks


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>