Load IIS Log Files Into SQL

From time to time I post little tidbits that I know I’ll need in the future.  Since Microsoft hasn’t updated their LogParser from version 2.2 since April of 2005, it’s safe to say this won’t be changing any time soon.

So basically if you want to import your IIS log files into SQL Server so that you can query fast and furious you’ll need to install LogParser from Microsoft Here.

Then you go to a command prompt and type something like the following.

"C:\Program Files\Log Parser 2.2\LogParser" "SELECT * FROM C:\WhereEverYourLogFilesAre\*.log TO T1"  -o:SQL -server:(local) -database:TRACK -createtable:ON -i:iisw3c

If you have a 64 bit version of Windows the directory will be “Program Files (x86)” instead of just “Program Files”.

This should create a table called T2 in database TRACK on your local machine if you have SQL Server installed.

The syntax was a little hard for me for some reason.  Hopefully Google will be kind and bring you here when you want a real example.

Leave a Reply

Your email address will not be published. Required fields are marked *

eight × = 8

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>