Question

I'm using MS Log Parser to do simple analytics against IIS logs.

I want a query that generates a report indicating the count of unique IPs hitting URLs, resulting in something like:

URL | Unique_IPs | Total_Views

url1 3 100 url2 5 253

etc.

The problem I'm having is that Log Parser doesn't allow count(DISTINCT c-ip) when using a group by, and I need the group by to get the hit count per URL.

Anyone know how to do this kind of query in Log Parser?

Thanks!

Was it helpful?

Solution

Check out Log Parser Rocks! - example 25) Unique visitors by day should give you a starting point.

Because of the missing DISTINCT you'll have to create 2 queries.


quoting from the above link to provide a full answer here

25) Unique visitors per day. This requires two queries. The first query selects from the IIS logs into a CSV file, and the second selects from that CSV file.

Query 1

logparser "SELECT DISTINCT cs-username, date 
INTO tempUniqueVisitorsPerDay.csv 
FROM logs\iis\ex*.log 
WHERE cs-username <> NULL 
GROUP BY Date, cs-username"

Query 2

logparser "SELECT date, count(cs-username) as UniqueVisitors 
INTO test.txt 
FROM tempUniqueVisitorsPerDay.csv 
GROUP BY date"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top