Custom Logging Modules
Updated: August 22, 2005
Applies To: Windows Server 2003, Windows Server 2003 with SP1
IIS supports custom logging modules that are COM objects that must expose a base set of methods for IIS to use. These methods are defined in the ILogPlugin, ILogPluginEx, and ILogUIPlugin interfaces. You can implement custom logging modules when you create your own log file formats or when you manipulate log data. For more information about the methods for the ILogPlugin, ILogPluginEx, and ILogUIPlugin interfaces, see Custom Logging Module Interfaces on MSDN. For information about creating custom logging modules, see Creating a Custom Logging Module for IIS on MSDN.
Custom Logging Considerations
Before you create and use custom logging modules, it is important to consider the following:
If you want to implement custom logging for a site, consider synchronization issues. For example, different instances of a logging module can record information for different applications within the same site — but from different worker processes. To avoid synchronization problems, you can write a per-application pool log instead of a per-site log or you can use Microsoft® Win32® application programming interface synchronization primitives. Alternatively, for existing custom logging modules that you cannot change, all of the site's applications must be assigned to the same application pool to avoid the possibility of multiple worker processes writing entries to the same log file. In addition, the application pool must have the following configuration:
- MaxProcesses = 1
- DisallowOverlappingRotation = True
- MaxProcesses = 1
Because the worker process, not HTTP.sys, handles custom logging modules, the HTTP.sys kernel-mode cache is disabled for the site for which a custom logging module is specified.
In IIS 6.0, HTTP.sys uses the LocalSystem user account when writing log data to the currently selected LogFiles directory. Custom logging modules, however, use the accounts of the application pool in which they are running. The default account for application pools is the Network Service user account. For this reason, custom logging modules can cause write problems or errors when writing to the default LogFiles folder. You can correct this problem by configuring your custom logging modules to write to a different folder.
If you choose to have custom logging modules write to a different folder, be sure to set a proper ACL on the new folder. Consider giving write permissions to the IIS_WPG group, which is a built-in user group that has the minimum set of permissions that IIS requires. If the identity account is not in the IIS_WPG group and has not been assigned appropriate rights, then the worker process fails to start. For more information about ACLs, see Managing a Secure IIS 6.0 Solution.
|When a custom logging module is loaded, IIS disables the HTTP.sys kernel-mode cache. For this reason, implementing a custom logging module can degrade overall server performance.|
Once you have created a custom logging module, you can add your format to the Active Log Format list in IIS Manager. To add the custom format to the Active Log Format list, you must edit the metabase with the Adsutil.vbs command-line script.