Configuring SMTP Logging to an Access Database

In this article we will look at how you can configure Exchange to perform SMTP logging to an Access database.

The first thing you will need to do is create an Access database, it does not matter what you call the database, for this article I have called it SMTPLOG.MDB. When you create the file I would recommend that you create a directory on your Exchange server and save the database in that directory.

In your database you will need to create a table that contains the following fields, again it does not matter what you call the table, but for this article I have simply called it SMTP.

These are the fields that you will need to create, it is important that you use the exact field names, type and size; attributes you can set in the Access database are optional.

Field Name

Type

Size

ClientHost

Text

255

UserName

Text

255

LogTime

Date/Time

Service

Text

255

Machine

Text

255

ServerIP

Text

50

ProcessingTime

Number

Integer

BytesRecvd

Number

Integer

BytesSent

Number

Integer

ServiceStatus

Number

Integer

Win32Status

Number

Integer

Operation

Text

255

Target

Text

255

Parameters

Text

255

Once you have created the database and saved it to the server you must configure an ODBC System Data Source for the database.

1. On your Exchange server go to Administrative Tools and select Data Sources (ODBC) from the menu, the ODBC Data Source Administrator will now be displayed.

2. Select the System DSN tab and click Add.

3. In the Create New Data Source dialog box, select Microsoft Access Driver (*.mdb), and click Finish.


Figure 1- Create New Data Source

4. The ODBC Microsoft Access Setup dialog box will now appear, enter an appropriate Data Source Name and Description, and click Select.


Figure 2 - ODBC Microsoft Access Setup

5. In the Select Database dialog box, navigate to the Access database that you created and saved earlier, click OK, click OK again to exit the ODBC Data Source Administrator.

Once you have configured the ODBC Data Source you will need to configure your Exchange server to send its SMTP logging to the Access database, to do this:

1. Open Exchange System Manager, and open the Properties for your SMTP Virtual Server, on the General tab, ensure that the Enable Logging checkbox is selected and that ODBC Logging is selected from the Active Log Format dropdown list.


Figure 3 - SMTP Virtual Server Properties

2. Click on Properties, the ODBC Logging Properties dialog box will now open, in the ODBC Data Source Name (DSN) field enter the name that you used when you created your ODBC DSN, in our example the name used was smtp, in the Table field enter the name of the table in Access that you want to log to, in our example the name used was smtp, you will also need to provide a username and password for an account that has write access to the Access database, click OK to close the ODBC Logging Properties dialog box, and then click OK to close the SMTP Virtual Server Properties dialog box.


Figure 4 - ODBC Logging Properties

3. In order for the changes you have made to the SMTP Virtual Server to take effect, you must stop and start your SMTP Virtual Server, once this has completed, logging should now take place in the Access database.

Once the data has been logged to the Access database, you can use Access to produce any number of queries and reports to help you monitor your SMTP traffic.

About Mark Fugatt

Mark Fugatt is a trainer and consultant for Pentech Office Solutions with a special focus on messaging systems. He is an MCT, MCSE, CTT, Microsoft Exchange MVP, the father of two great kids and the husband to a very patient and understanding wife, Sharon. You can reach him at mark@4mcts.com and visit Pentech's web site at www.4mcts.com

Share this article

Receive all the latest articles by email!

Get all articles delivered directly to your mailbox as and when they are released on MSExchange.org! Choose between receiving instant updates with the Real-Time Article Update, or a monthly summary with the Monthly Article Update. Sign up to the MSExchange.org Monthly Newsletter, written by Exchange MVP Henrik Walther, containing news, the hottest tips, Exchange links of the month and much more. Subscribe today and don't miss a thing!



Receive all the latest articles by email!

Receive Real-Time & Monthly MSExchange.org article updates in your mailbox. Enter your email below!
Click for Real-Time sample & Monthly sample

Become an MSExchange.org member!

Discuss your Exchange Server issues with thousands of other Exchange experts. Click here to join!

Solution Center

Readers' Choice

Which is your preferred Exchange Server Mail Archiving software solution?