Importing IIS Logs into a SQL Database / Table

1. Download the Log Parser tool from Microsoft here. I know, it’s old but works great.

2. Dump your IIS log files somewhere (ie: c:\temp\logs).

3. Run this in cmd:

C:\Program Files (x86)\Log Parser 2.2>logparser “SELECT * INTO iisLogs FROM c:\temp\logs\*.log ” -i:iisw3c -o:SQL -server:localhost -database:webLogs -username:sa -password:yourpass -createTable: ON

if you’re on 32bit, run Log Parser will be in this folder:

C:\Program Files\Log Parser 2.2>logparser “SELECT * INTO iisLogs FROM c:\temp\logs\*.log ” -i:iisw3c -o:SQL -server:localhost -database:webLogs -username:sa -password:yourpass -createTable: ON

Now you have a table w/ tons of data!

Importing IIS Logs into a SQL Database / Table

7 thoughts on “Importing IIS Logs into a SQL Database / Table

  1. As an update, when importing 8 million records, it takes about 1 & 1/2 hour:

    Statistics:
    ———–
    Elements processed: 8435752
    Elements output: 8435752
    Execution time: 5142.73 seconds (01:25:42.73)

    Like

  2. WAyne says:

    Copying and pasting the above didn’t work right out of the box for me. Had to delete and replace the double-quotes to correct an error with message “Error: detected extra argument “*” after query”. The paste must have seen the quote as a different codepage than the standard ANSI (8520?) code used within my DOS window.

    I’m running 64bit Win7 Pro SP1 Eng.

    Liked by 1 person

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