Question

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, for 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?

Was it helpful?

Solution

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 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top