IIS ODBC Logging (the way that works)

This post is mainly for my benefit (it may help others too).

I was asked at work to turn on IIS logging to an ODBC connection. I did a little Googleing and found this site http://support.microsoft.com/kb/245243. Microsoft recommends that you do not do this though because on a heavily used site it can cause performance issues. They appear to be so against the idea of doing it that the script that they provide in %Windir%\System32\Inetsrv does not work. The rest of the steps on that site are correct though. Here is the script that I used to create the table that will actually allow the logging to work:

CREATE TABLE [InternetLog] (
	[LogTime] [datetime] NOT NULL ,
	[ClientHost] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[service] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[machine] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[serverip] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[processingtime] [int] NULL ,
	[bytesrecvd] [int] NULL ,
	[bytessent] [int] NULL ,
	[servicestatus] [int] NULL ,
	[win32status] [int] NULL ,
	[operation] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[target] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[parameters] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	[username] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
	CONSTRAINT [PK_InernetLog] PRIMARY KEY  CLUSTERED
	(
		[LogTime]
	) WITH  FILLFACTOR = 90  ON [PRIMARY]
) ON [PRIMARY]
GO

With any luck we will just turn this on when it is needed and not leave it running all the time.

Advertisements

,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: