2025-04-27 07:49:33 -04:00

158 lines
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>ReadFilter</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
TempString = navigator.appVersion
if (navigator.appName == "Microsoft Internet Explorer"){
// Check to see if browser is Microsoft
if (TempString.indexOf ("4.") >= 0){
// Check to see if it is IE 4
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
}
}
else if (navigator.appName == "Netscape") {
// Check to see if browser is Netscape
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
//-->
</script>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad()
Dim frmContents
On Error Resume Next
If Not Parent Is Nothing Then
Set frmContents = Parent.Contents
If Not frmContents Is Nothing Then
frmContents.Window.TOCSynch_Click
End If
End If
End Sub
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="MS-IT-LOC" Content="Internet Information Services">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H3><A NAME="_readfilter"></A><SUP></SUP>ReadFilter</H3>
<P>This method allows you to read log records between a date and time range.</P>
<H6>Syntax</H6>
<P><I>OIISLog</I><B>.ReadFilter(</B> [<I>startDateTime</I>], [<I>endDateTime</I>] <B>)</B></P>
<P><B>&nbsp;</B></P>
<H6>Parameters</H6>
<DL>
<DT><I>startDateTime</I></DT>
<DD>Optional parameter indicating date and time after which log records are to be read.<BR>
</DD>
<DT><I>endDateTime</I></DT>
<DD>Optional parameter indicating date and time before which log records are to be read.<BR>
</DD>
<DT></DT>
</DL>
<P><span class=le><B>Important</B></span></P>
<P>Although the parameters are optional, at least one must be specified.</P>
<H6>Example</H6>
<P>The following example opens a log file in the <B>W3C Extended Log File Format</B>, and displays selective properties of the records in the specified date range.</P>
<P>--- Log_ReadFilter.asp ---</P>
<PRE><CODE>&lt;HTML&gt;
&lt;HEAD&gt;&lt;TITLE&gt;&lt;/TITLE&gt;&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;%
LogFile = Request.Form("logfile")
StartDate = Request.Form("startdt")
EndDate = Request.Form("enddt")
%&gt;
&lt;H3&gt;Display a Range of Log Records by Date&lt;/H3&gt;
&lt;FORM NAME="getlogfilename" METHOD="POST" ACTION="Log_ReadFilter.asp"&gt;
Please enter the full path name of a log file to read in %SystemRoot%\system32\LogFiles\*SVC*\*.log:&lt;BR&gt;
&lt;input type="TEXT" NAME="logfile" size=70 value=&lt;%=LogFile%&gt;&gt;&lt;BR&gt;&lt;BR&gt;
Start DateTime:
&lt;input type="TEXT" NAME="startdt" value=&lt;%=StartDate%&gt;&gt; (Optional)&lt;BR&gt;
End DateTime:
&lt;input type="TEXT" NAME="enddt" value=&lt;%=EndDate%&gt;&gt; (Optional)&lt;BR&gt;
(Use the format 'MM/DD/YYYY HH:MM:SS AM/PM')&lt;BR&gt;&lt;BR&gt;
&lt;INPUT TYPE="SUBMIT" VALUE="Submit"&gt;
&lt;/FORM&gt;
&lt;%
''''''''''''''''''''
' Log file formats:
' "NCSA Common Log File Format"
' "Microsoft IIS Log File Format"
' "W3C Extended Log File Format"
'''''''''''''''''''''
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
If (fsoObject.FileExists(LogFile)) Then
Set oRead = CreateObject ("MSWC.IISLog")
oRead.OpenLogFile LogFile, 1, "W3SVC", 1, "W3C Extended Log File Format"
If Not (StartDate = "" Or EndDate = "") Then
oRead.ReadFilter StartDate,EndDate
End If
oRead.ReadLogRecord
%&gt;
&lt;TABLE Border=1&gt;
&lt;TR&gt;&lt;TD&gt;
&lt;B&gt;Date/Time&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;Client IP&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;User Name&lt;/TD&gt;&lt;TD&gt;&lt;B&gt;URL Requested
&lt;/B&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;%
Do While Not oRead.AtEndOfLog
Response.Write "&lt;TR&gt;&lt;TD&gt;&amp;nbsp;" &amp; oRead.DateTime &amp; "&lt;/TD&gt;"
Response.Write "&lt;TD&gt;&amp;nbsp;" &amp; oRead.ClientIP &amp; "&lt;/TD&gt;"
Response.Write "&lt;TD&gt;&amp;nbsp;" &amp; oRead.UserName &amp; "&lt;/TD&gt;"
Response.Write "&lt;TD&gt;&amp;nbsp;" &amp; oRead.URIStem &amp; "&lt;/TD&gt;&lt;/TR&gt;"
oRead.ReadLogRecord
Loop
%&gt;
&lt;/TABLE&gt;
&lt;%
oRead.CloseLogFiles 1
ElseIf Not (LogFile = "") Then
Response.Write "ERROR: " &amp; LogFile &amp; " does not exist."
End If
%&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;</CODE></PRE>
<hr class="iis" size="1">
<p align="center"><em><a href="../../../common/colegal.htm">&copy; 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
</BODY>
</HTML>