开发者

Microsoft LogParser: How to use parameters in a file

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 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜