Logging Utility

The IIS Log component is used to create an IISLog object, which enables your applications to read from the IIS log. This component allows you to quickly create, for example, ASP scripts or VB components that programmatically walk through daily log files so that certain types of information can be extracted.

Important   The user accessing the ASP script that instantiates the IISLog component must be authenticated as an Administrator or Operator on the server on which IIS is running. If the user is only anonymous, the IIS Log component will not function properly.

File Names
Logscrpt.dll The Logging Utility component

Syntax

Set oVar = Server.CreateObject( MSWC.IISLog )

 

Parameters
oVar
Specifies the name that can be used as a reference to the IISLog component.
Methods
AtEndOfLog Indicates whether all records have been read from the log file.
CloseLogFiles Closes all open log files.
OpenLogFile Opens a log file for reading or writing.
ReadFilter Filters records from the log file by date and time.
ReadLogRecord Reads the next available log record from the current log file.
WriteLogRecord Writes a log record to the current log file.

Properties
BytesReceived Indicates the bytes received.
BytesSent Indicates the bytes sent.
ClientIP Indicates the client's host name.
Cookie Indicates the client's cookie.
CustomFields Indicates an array of custom headers
DateTime Indicates the date and time in GMT.
Method Indicates the operation type.
ProtocolStatus Indicates the protocol status.
ProtocolVersion Indicates the version string.
Referer Indicates the referrer page.
ServerIP Indicates the server's IP address.
ServerName Indicates the server name.
ServerPort Indicates the port number.
ServiceName Indicates the service name.
TimeTaken Indicates the total processing time.
URIQuery Indicates any parameters passed with the request.
URIStem Indicates the target URL.
UserAgent Indicates the user agent string.
UserName Indicates the user's name.
Win32Status Indicates the Win32 status code.

Remarks

The following steps are necessary to use the IIS Log component effectively:

  1. Use the OpenLogFile method to specify from which log file or files the IISLog component should read.
  2. Use the ReadLogRecord to read the appropriate log records.
  3. Use the IIS Log component properties to retrieve specific information from the log records.

Important   Only log files created by logging modules that support log file reading will be accessible through this component. The four built-in logging modules that come with IIS support log-file reading, but if you are using a custom or third-party logging module, you will need to enhance the logging module. See Extending IIS Logging Capabilities for more information.