LOGPARSER #3: Unique users per day


This is a combination of two scripts you need to use to get the unique number of users each day. This is for Logparser 2.2 and earlier if i remember correct. Maybe later version will give you this in another way. I’ve seen a variety of samples out there but this is the only true way I know if getting this.

First you need to run this script

SELECT
    DISTINCT cs-username,
    date
    INTO tempUniqueVisitorsPerDay.csv
FROM
    logs\iis\ex*.log
WHERE
    cs-username <> NULL
Group By 
    Date,
    cs-username

Then you need to run this script towards the populated .CSV file

SELECT
    date,
    count(cs-username) as UniqueVisitors
    into test.txt
FROM
    tempUniqueVisitorsPerDay.csv
GROUP BY
    date

You can really easy put this into a .BAT file to get this more automated. Then you can just click the .BAT file to get the numbers. Or even better schedule a work that run the .BAT file.

- Put each of the scripts into a separate .SQL file. Just put each script into notepad, save,  and rename the file afterwards.
- Create a new notepad file and paste this into it. Rename to .BAT extension.
- Make sure the .BAT file is in your Logparser directory

logparser file:uniqueusersperday1.sql
logparser file:uniqueusersperday2.sql

Hope this helps!

//Anders

Skip to main content