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


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.

More 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:

  1. Set up an ODBC-compliant database. To do this in Microsoft SQL Server, follow these steps:
    1. Click Start, point to Programs, point to Microsoft SQL Server, and then click Enterprise Manager.
    2. Right-click the server you want to connect to, point to New, and then click Database.
    3. Type a name for the new database in the Name box, and then click OK.
  2. Create the table for ODBC logging. To do this in Microsoft SQL Server, follow these steps:

    1. Click Start, point to Programs, point to Microsoft SQL Server, and then click Query Analyzer.
    2. Locate and open the Logtemp.sql file. The default location for this file is the "\system drive\system32\inetsrv\" 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) )
    3. 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.
  3. Create a system Data Source Name (DSN). To do this, follow these steps:
    1. Click Start, point to Control Panel, point to Administrative Tools, and then click Data Sources (ODBC).

    2. On the System DSN tab, click Add.

    3. Click SQL Server, and then click Finish.

    4. Type a name for this DSN in the Name box and type a description for this DSN in the Description box.
    5. In the Server box, click to select the computer that is running SQL Server where the database resides, and then click Next.
    6. Click With SQL Server authentication using a network login ID and password entered by the user, and then click Next.
    7. 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.
    8. Click Finish.
    9. Click Test Data Source. When you receive a Tests completed successfully
      message, click OK two times.
  4. Enable logging in ODBC format. To do this, follow these steps:
    1. Open Internet Services Manager. To do this, click Start, click Run, type \system drive\system32\inetsrv\iis.msc, and then click OK.
    2. In Internet Services Manager, click the SMTP virtual server, and then click Properties on the Action menu.
    3. On the General tab, click to select the Enable Logging check box.
    4. In the Active log format box, click ODBC Logging, and then click Properties.
    5. In the ODBC Data Source Name (DSN) box, type the ODBC DSN name that you set up in step 3.
    6. 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.
    7. Type a valid username in the User name box.
    8. Type the password to the database server in the Password box, and then click OK two times.