0

I have a flask/python web deployed in IIS. I know the following statement gets the current logged in user info: request.environ.get('REMOTE_USER')

The website is for internal use, so no flask login is used. However, I would like to get all the unique visitors' info during a period of time. Is there any quick way to do that?

Thanks!

Ames ISU
  • 167
  • 1
  • 2
  • 12

1 Answers1

0

You could use the log parser tool and run below query to get the number of unique visitors for your site:

SELECT DISTINCT date, c-ip 
INTO tmp.txt 
FROM 'C:\LogFiles\web\ex*'

SELECT date, count(c-ip) AS UniqueVisitors
INTO Unique.txt
FROM tmp.txt 
GROUP BY date

To run these two, you can either download the files and use this syntax:

logparser file:UniqueVisitors1.sql -i:W3C -o:W3C
logparser file:UniqueVisitors2.sql -i:W3C -o:NAT -rtp:-1

Or type the query as an argument to logparser.exe, for example:

logparser "SELECT DISTINCT date, c-ip INTO tmp.txt FROM 'C:\LogFiles\web\ex*'" -i:W3C -o:W3C

And the same with the second query.

As you have probably already figured out, you need to replace "C:\LogFiles\web\ex*" with the path to where you store your log files.

You could download log parser from below link:

https://www.microsoft.com/en-us/download/details.aspx?id=24659

reference link:

counting unique visitors with flask

https://support.microsoft.com/en-us/help/910447/log-parser-2-2-and-asp-net

How do I count unique visitors to my site?

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26