SoFunction
Updated on 2025-03-10

IIS log to SQLserver implementation method

The default IIS log format is txt, which is very inconvenient to check. I am really lazy to read it, so I found some information online and read it.
It is more convenient to store logs in SQLServer.


1. Create an iis database, add the InetAdmin user, specify that the user is the owner of the iis database, and set relevant permissions.
2. Execute the query file and create a table. The contents are as follows:

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. According to the default value of ODBC log of IIS5, enter the ODBC data source manager to establish a "System DSN" named "HTTPLOG" and connect to the iis database. Use the InetAdmin account when establishing it.
4. Change "Activity Log Format (V)" to "ODBC Logging ".

Then you can check it as needed.