Setting Logging Properties

When IIS processes an HTTP request to a server it also makes an instance of the IInetLogInformation interface available to the server's logging module. IInetLogInformation is COM compliant which means it inherits the IUnknown interface. Logging modules can access IInetLogInformation methods by obtaining a pointer via the IUnknown::QueryInterface method.

The logging module determines which methods to query for by examining the MD_LOGEXT_FIELD_MASK identifier in the metabase. MD_LOGEXT_FIELD_MASK is a DWORD of flag bits that specify individual methods of the IInetLogInformation interface. For example, the constant MD_EXTLOG_BYTES_SENT has been defined as value 0x00001000 for the DWORD. If this constant is specified in the metabase, the logging module will query IInetLogInformation for the GetBytesSent method, which returns the number of bytes sent as a result of the HTTP request.

The flags in the MD_LOGEXT_FIELD_MASK identifier can be set with the Internet Service Manager. This process is described in Logging Web Site Activity topic of the Server Administration section. The flags can also be set by a script that sets the value of an appropriate automation property. For example, the MD_EXTLOG_BYTES_SENT flag corresponds to the LogExtFileBytesSent automation property. The following script uses this automation property to set the MD_EXTLOG_BYTES_SENT flag in the metabase to True.

<%
Dim CurrServer
Set CurrServer = GetObject("IIS:/LocalHost/W3svc/1")
CurrServer.LogExtFileBytesSent = True
CurrServer.SetInfo

%>

A sample script that you can use to enumerate and change logging properties is provided in the Developer Samples section of the documentation. For more information on using automation properties to administer IIS see IIS Administration.