BETA
 
How to import IIS logs into a database
Category: Computers
Views: 283  

This windows batch script will loop through files in a directory filtering for files with the extension .log. The log LogParser is executed with the database parameters.

To use this windows batch script you must download Microsoft's Log Parser.
http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en

Then save the below script as something.bat file and execute!


echo off
echo.
echo IIS Log Parser Import To SQL Server

FOR /r C:\temp\ %%G IN (*.log) DO c:\"program files"\"log parser 2.2"\LogParser "SELECT date, time, c-ip, cs-username, s-ip, s-port, cs-method, cs-uri-stem, cs-uri-query, sc-status, cs(User-Agent) FROM %%G TO TestLogTable" -o:SQL -server:dw-ics-dev -driver:"SQL Server" -database:IISLogDatabase -username:youruname -password:yourpassword -createtable:ON

echo.

Add Comment
Name:


Comments 
8/10/2008 6:31:07 PM top

Guest

awesome script thanks heaps.


Page: << Previous  Next >>  1  


Author:

manit
Posts 86

Top Lists:more...
1 . Useful functions within C... (0)
2 . A Collection Of Useful .N... (8)
3 . Best Restaurants in Addis... (21)
4 . Hot girls on MySpace (20)
5 . Best US cities to visit..... (12)
6 . Laugh-O-Potamus (12)
7 . It's the End of the World (5)
8 . Some of the craziest webs... (4)
9 . Ways to get pirated softw... (7)
10 . Things to know when trave... (7)

Top Users:more...
1 . manit - (86)
2 . manit - (86)
3 . LaughOPotamus - (29)
4 . LaughOPotamus - (29)
5 . Dawn - (7)
6 . Dawn - (7)
7 . eepah - (13)
8 . eepah - (13)
9 . ivan - (6)
10 . ivan - (6)