IIS LOG를 SQL에 옮겨서 분석할수 없을까 하고 찾다 보니
MS에서 Log Parser 2.2를 배포하고 있었다.
기본사용법
LogParser -i:EVT -o:SQL “SELECT * INTO EventLog FROM System” -server:Laptop\SqlExpress -database:Keeper -driver:”SQL Server” -createTable:ON
LogParser -i:EVT -o:SQL “SELECT * INTO EventLog FROM System” -server:Laptop\SqlExpress -database:Keeper -driver:”SQL Server” -createTable:ON
로그파일을 자동으로 찾아서 처리하도록 하려면 다음과 같이 배치 파일을 만들면 된다.
REM Use on servers set to UK date
SET CurrentLogFile=ex%date:~8,2%%date:~3,2%%date:~0,2%.log
SET CurrentLogFile=ex%date:~8,2%%date:~3,2%%date:~0,2%.log
REM SET the path to the IIS Log Files Folder. NOTE: If your IIS server has multiple Websites you may have to change the path.
SET LogFilesFolder=%SYSTEMROOT%\system32\Logfiles\W3SVC1\
SET LogFilesFolder=%SYSTEMROOT%\system32\Logfiles\W3SVC1\
ECHO Attempting to process IIS Log File: %LogFilesFolder%%CurrentLogFile%
PAUSE
LogParser -i:IISW3C -o:SQL “SELECT * INTO IISLog FROM %LogFilesFolder%%CurrentLogFile%” -server:Laptop\SqlExpress -database:Keeper -driver:”SQL Server” -createTable:ON
PAUSE
LogParser -i:IISW3C -o:SQL “SELECT * INTO IISLog FROM %LogFilesFolder%%CurrentLogFile%” -server:Laptop\SqlExpress -database:Keeper -driver:”SQL Server” -createTable:ON
PAUSE