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.
|