Microsoft KB Archive/303738

= How to enable SMTP protocol logging for Internet Information Services in Windows Server 2003 and in Windows 2000 =

Article ID: 303738

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft Windows Server 2003, Standard Edition (32-bit x86)
 * Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
 * Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
 * Microsoft Windows 2000 Server
 * Microsoft Internet Information Services 6.0
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q303738





INTRODUCTION
This step-by-step guide describes how to enable protocol logging for Microsoft Internet Information Services (IIS) in Microsoft Windows Server 2003 and in Microsoft Windows 2000. Protocol logs track the commands that the Simple Mail Transfer Protocol (SMTP) virtual server receives from SMTP clients over the network. You can choose which logging format that the SMTP server uses for recording information.



Enabling logging in ASCII text format
When you identify the SMTP virtual server, you designate the TCP port that the SMTP server uses to receive incoming messages. When you set up a log file, remember that the log formats and the default file names are the same as those used by other services in IIS. If you choose the default names, all transactions for all services are recorded in the same file.

To enable logging that uses ASCII text format, follow these steps:
 * 1) In Internet Services Manager, click the SMTP virtual server, and then click Properties on the Action menu.
 * 2) On the General tab, click Enable logging.
 * 3) In the Active log format box, click a log format.
 * 4) Click Properties, and then specify the log file size and location on the General Properties tab.
 * 5) If you selected the W3C Extended Logging format, click the Extended Properties tab, and then select the items that you want to track.

Note If you configure the file to be in a different location from the default, make sure that the file is stored on a local drive, not on a network drive. Also, because logging is shared with IIS, some of the names are not specific to SMTP.

Enabling logging in ODBC format
To enable logging in Open Database Connectivity (ODBC) format, follow these steps:  Set up an ODBC-compliant database. To do this in Microsoft SQL Server, follow these steps:  Click Start, point to Programs, point to Microsoft SQL Server, and then click Enterprise Manager. Right-click the server you want to connect to, point to New, and then click Database. Type a name for the new database in the Name box, and then click OK.  Create the table for ODBC logging. To do this in Microsoft SQL Server, follow these steps:  Click Start, point to Programs, point to Microsoft SQL Server, and then click Query Analyzer.</li>  Locate and open the Logtemp.sql file. The default location for this file is the &quot;\system drive\system32\inetsrv\&quot; folder.

Note The Logtemp.sql file should look similar to the following: create table inetlog ( ClientHost varchar(255), username varchar(255), LogTime datetime, service varchar( 255), machine varchar( 255), serverip varchar( 50), processingtime int, bytesrecvd int, bytessent int, servicestatus int, win32status int, operation varchar( 255), target varchar(255), parameters varchar(255) ) </li> Paste the contents of the Logtemp.sql file into the Query Analyzer, and then click Execute on the Query menu to create the new table for ODBC logging.</li></ol> </li> Create a system Data Source Name (DSN). To do this, follow these steps:  Click Start, point to Control Panel, point to Administrative Tools, and then click Data Sources (ODBC).</li> On the System DSN tab, click Add.</li> Click SQL Server, and then click Finish.</li> Type a name for this DSN in the Name box and type a description for this DSN in the Description box.</li> In the Server box, click to select the computer that is running SQL Server where the database resides, and then click Next.</li> Click With SQL Server authentication using a network login ID and password entered by the user, and then click Next.</li> Click to select Change the Default Database to, click the SQL Server database that you created to function as the repository for the System Monitor data, and then click Next.</li> Click Finish.</li> Click Test Data Source. When you receive a Tests completed successfully message, click OK two times.</li></ol> </li> Enable logging in ODBC format. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>Open Internet Services Manager. To do this, click Start, click Run, type \ \system32\inetsrv\iis.msc, and then click OK.</li> <li>In Internet Services Manager, click the SMTP virtual server, and then click Properties on the Action menu.</li> <li>On the General tab, click to select the Enable Logging check box.</li> <li>In the Active log format box, click ODBC Logging, and then click Properties.</li> <li>In the ODBC Data Source Name (DSN) box, type the ODBC DSN name that you set up in step 3.</li> <li>Type inetlog in the Table box.

Note This name is specified in the Logtemp.sql file. This file is located in the %windir%\System32\Inetsrv folder.</li> <li>Type a valid username in the User name box.</li> <li>Type the password to the database server in the Password box, and then click OK two times.</li></ol> </li></ol>

Keywords: kbhowtomaster KB303738

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.