Run a SQL Script to Automate Creating the Table section, or create a table manually by using the fields in the Table - Field Format section. The default table name is InternetLog on the ODBC Logging Properties page in the Internet Services Manager (ISM) Microsoft Management Console (MMC).
NOTE: These steps work for World Wide Web (WWW) or File Transfer Protocol (FTP) logging on the Web server.
- Log on to the server with a user account that has administrative access on the computer that is running SQL Server.
- Open SQL Server Query Analyzer.
- On the File menu, click Open.
- Locate the %Windir%\System32\Inetsrv folder.
- Click Logtemp.sql, and then click Open.
- In the first line of the Logtemp.sql script, replace inetlog with InternetLog.
- Select the database to create the InternetLog table. By default, the database is Master, but Microsoft does not recommend that you use this database.
- Click Query, and then click Execute.
- On the IIS computer, open Control Panel, double-click the ODBC data source, click the System DSN tab, and then click Add.
- When the Create New Data Source window appears, click to select SQL Server, and then click Finish.
- In the Name box, type HTTPLOG, type a description, click to select the SQL server that you want to connect to, and then click Next. If the SQL server is on the same computer, select (local).
- In the creation wizard, make sure that you click to select With Windows NT authentication using the network login ID for the computer that is running SQL Server. Examine the client configuration, and use the default Named Pipe setting. Make sure that the SQL server name is correct, and then click OK.
- Click Next.
- Map the default database to the database where the template table resides, and then click Next.
- If you want to, you can click to select Save long running queries to the log file and Log ODBC driver statistics to the log file in the wizard.
- Click Finish.
- At the end of the wizard, click Test Data Source. Make sure that you have successfully connected to the computer that is running SQL Server, and then click OK to exit.
- In the ISM MMC, right-click the Web site, and then click Properties.
- Click the Web Site tab.
- In the Active log format list, click to select ODBC Logging. You can ignore the user name and password on the ODBC Logging Properties page if you selected Windows NT Integrated authentication when you set up the system DSN that is mapped to the computer that is running SQL Server.
- Click Apply, and then click OK.NOTE: If an account is specified on the ODBC Logging Properties page, the Username field in the SQL Server table is blank or contains a dash (-). If a domain account is used, the account name appears in the SQL Server logging table.
- : If an account is specified on the ODBC Logging Properties page, the In the ISM MMC, right-click the Web site, and then click Stop to stop your Web site.
- : If an account is specified on the ODBC Logging Properties page, the Right-click the Web site, and then click Start to restart your Web site.
- Microsoft does not recommend IIS logging to a SQL Server table if the IIS computer is a busy server. Sending logging data to a SQL Server database for a busy Web site consumes system resources. In this case, you may want import the IIS logs to a SQL database later.For more information about importing IIS logs to SQL, click the following article numbers to view the articles in the Microsoft Knowledge Base:296085 How to use SQL Server to analyze Web logs296093 PrepWebLog utility prepares IIS logs for SQL bulk insert
- By default, the logging configuration uses Named Pipes for the SQL Server connection. If you are using a remote computer that is running SQL Server, you may have to configure TCP/IP for the SQL Server connection.
NOTE: For other database systems, you must configure a system DSN to link the database and table that contain the appropriate fields for the logging format, and then follow the steps in Configuring IIS for ODBC Logging to set up logging.