I have started to use Microsoft LogParser in order to analyse IIS logs.
LogParser allows using SQL query from a file and supply parameters to the query directly in a command line, fo开发者_运维知识库r example:
LogParser file:query.sql?date=2010-12-29 -i:IISW3C
query.sql is a file name with SQL query
date=2010-12-29 is a parameter that is supplied to the SQL query
Here is content of query.sql:
select cs-uri-stem
,count(*)
from logs.log
where date = <date>
group by cs-uri-stem
The problem is that I don't know how to call parameter in the file. Does anybody know this?
You can use the parameters in you query file like this
%VARIABLE_NAME%
So, in your example
select cs-uri-stem
,count(*)
from logs.log
where date = %date%
group by cs-uri-stem
精彩评论