In order to properly configure a new custom logging module, or to log custom information to an existing, standard IIS logging module, you must access and modify the administration properties stored in the IIS metabase.
The logging module determines which methods to query for by examining the LogExtFileFlags identifier in the metabase. LogExtFileFlags is a DWORD of flag bits that specify individual methods of the IInetLogInformation interface. For example, the constant LogExtFileBytesSent 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 LogExtFileFlags identifier can be set with the Internet Service Manager. The flags can also be set by a script. The following script sets the LogExtFileBytesSent 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 Administering IIS Programmatically.
In IIS versions 5.0 and later, there is a special metabase node, under /LM/Logging, called CustomLogging. This node is used to store metadata, in the form of properties, that describe the various types of information that can be logged by IIS.
When the LogCustomInformation method is called, the custom logging module-provided ILogPluginEx interface, the CustomLogging metabase subtree is used to determine how to record the custom information.
Each logging information field, such as "time," has a corresponding child node off of CustomLogging. For each logging field, the following information is stored in the metabase:
The implementor of LogCustomInformation (either IIS or your custom logging module) is responsible for checking to see whether logging is enabled or disabled for that particular field, using the last two items above.
In general, custom logging information fields will be clustered in logical groupings and placed in a child subnode to CustomLogging. For instance, IIS creates two subnodes, ProcessAccounting and ExtendedProperties, that contain the individual field nodes for the process accounting and W3C Extended logging module, respectively. Each of these group nodes should specify to what Internet services the logging fields apply, using the LogCustomPropertyServicesString property.
Note Two logging information fields, time and date, are considered global, and are stored as immediate children of CustomLogging. It is generally not necessary to duplicate these fields in the individual field groups that are children of CustomLogging, unless you desire some special behavior.