July 2000
Intermediate to advanced
492 pages
14h 53m
English
The following script demonstrates the use of several of the Logging Utility object's properties and methods.
This script opens the entire extended log file filtering for today's date. Then the script iterates through all the records that match the filter and displays the information from the records that represent large-sized HTTP requests.
Note that you must set your extended logging so that BytesReceived is captured or this example will not work.
<HTML> <HEAD> <TITLE>Logging Utility Example</TITLE> <!-- METADATA TYPE="typelib" FILE="c:\WINNT\system32\inetsrv\logscrpt.dll" --> </HEAD> <BODY> <% ' Instantiate a Logging Utility object to read the ' records from the standard log file. Set objLogUtil = Server.CreateObject("MSWC.IISLog") ' Open the standard log file for reading. objLogUtil.OpenLogFile _ "c:\winnt\system32\logfiles\W3SVC1\extend1.log", ForReading, "W3SVC", 1, 0 ' Filter the log file's entries for today's activity. objLogUtil.ReadFilter Date(), Date( ) %> <TABLE> <TR> <TH>Date</TH> <TH>Client IP</TH> <TH>User Name</TH> <TH>Bytes Received</TH> </TR> <% ' Iterate through the records. Do While Not objLogUtil.AtEndOfLog ' Read in the next record. objLogUtil.ReadLogRecord ' If the record's corresponding bytes received ' are greater than 2000, display the record in today's report. If objLogUtil.BytesReceived > 2000 Then %> <TR> <TD><% = objLogUtil.DateTime %></TD> <TD><% = objLogUtil.ClientIP %></TD> <TD><% = objLogUtil.UserName %></TD> <TD><% ...Read now
Unlock full access