Analyze IIS logs using SQL Server

Code by:

Marthin Freij


Konstruktor Sweden AB
Citizen

Owner, developer and trainer at Konstruktor Sweden AB

This download contains an XML format file to use with OPENROWSET in SQL Server plus some useful queries. More details in this blogpost.

Used for Product: EPiServer CMS 6
Code sample:

 

select 
    top 25 *
from 
    openrowset(
        bulk 'c:\mylogfile.log', 
        formatfile = 'c:\iislog-format.xml'
    ) as logfile
    


All use of the code is on a “use at your own risk” basis. Episerver is under no circumstances responsible for any direct or indirect loss experienced by users or project owners, when downloading and using code presented within the section Code on Episerver World. Please note that this is example code and should not be used within production environment without testing. Episerver do not support the code examples posted within the section Code on Episerver World.