PDA

View Full Version : [SRCDS]CountryAnalyzer, now also with Cities


Sillium
05-06-2009, 07:21
Hi everybody!

Some people at our forums wanted to know where do the people come from who connect to our server, so I wrote a command line application to parse the log files and create a statistic.
If you want to use it you need the GeoIP.dat from maxmind (http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/) and .NET 2.0

Start it like this:
CountryAnalyzer.exe PATH_TO_GEOIP PATH_TO_LOGS
e.g. CountryAnalyzer.exe ./GeoIP.dat ./logsIt will parse through all the log files (*.log) and print a statistic like this:
Total connections: 4394
[Germany, 2718]
[United Kingdom, 333]
[United States, 148]
[Russian Federation, 140]
[Sweden, 135]
[France, 128]
[Finland, 91]
[Italy, 80]
[Netherlands, 69]
[Norway, 69]
[Austria, 63]
[Denmark, 49]
[Switzerland, 36]
[Spain, 34]
[Canada, 34]
[Poland, 33]
[Czech Republic, 31]
[Hungary, 28]
[Belgium, 20]
[Slovakia, 15]
[Ukraine, 15]
[Ireland, 12]
[Israel, 12]
[Bulgaria, 10]
[Slovenia, 10]
[Lithuania, 9]
[Brazil, 7]
[Greece, 7]
[Portugal, 7]
[Estonia, 7]
[Mexico, 5]
[Croatia, 5]
[Latvia, 4]
[Romania, 4]
[Saudi Arabia, 4]
[Iceland, 3]
[Turkey, 3]
[Serbia, 3]
[United Arab Emirates, 2]
[Belarus, 2]
[Gibraltar, 2]
[Luxembourg, 2]
[Thailand, 1]
[Singapore, 1]
[Australia, 1]
[Aland Islands, 1]
[Qatar, 1]I only tested it with TF2 logs! If you try it with anything else and run into an error let me know and send me the log file :-)

Sillium
05-06-2009, 08:23
Here is another version. Now it is possible to count every IP only once.

Start like this:
CountryAnalyzer.exe ./GeoIP.dat ./logs falsefalse = every IP is only counted once
true = don't care about IPs

pheadxdll
05-06-2009, 08:51
Very neat. It could be used to make some interesting statistists.

Also, this post should probably go under snippets, tutorials, extensions. I'd hate to see this post get bumped by most of the garbage in General.

Sillium
05-06-2009, 11:21
Yeah you're probably right.

If an Admin sees this please move it :-) Thx!!

Sillium
05-08-2009, 05:20
And another Version:

This time we only count every SteamID once and every IP once. So if a SteamID is already known we won't count it anymore and move on. If different SteamIDs used the same IP we count the IP only once.

Usage:
CountryAnalyzer.exe ./GeoIP.dat ./logsNote that the true/false parameter is gone.

Example output
Total connections: 4394
Total counted IPs: 1815
Total counted SteamIDs: 1864

[Germany, 609]
[United Kingdom, 198]
[United States, 120]
[Russian Federation, 104]
[France, 103]
[Sweden, 99]
[Finland, 63]
[Italy, 55]
[Norway, 52]
[Netherlands, 51]
[Denmark, 43]
[Canada, 29]
[Austria, 29]
[Spain, 27]
[Poland, 26]
[Czech Republic, 24]
[Switzerland, 21]
[Hungary, 21]
[Belgium, 19]
[Israel, 12]
[Slovakia, 11]
[Ukraine, 11]
[Bulgaria, 10]
[Ireland, 9]
[Slovenia, 7]
[Brazil, 6]
[Lithuania, 6]
[Estonia, 6]
[Croatia, 5]
[Portugal, 5]
[Greece, 4]
[Romania, 4]
[Turkey, 3]
[Latvia, 3]
[Mexico, 3]
[Belarus, 2]
[United Arab Emirates, 2]
[Luxembourg, 2]
[Iceland, 2]
[Serbia, 2]
[Qatar, 1]
[Gibraltar, 1]
[Singapore, 1]
[Thailand, 1]
[Saudi Arabia, 1]
[Aland Islands, 1]
[Australia, 1]

Sillium
05-20-2009, 02:56
Just to let everyone know: It works with L4D-Logs too.

If anyone could supply me with an CSS/DODS Log I'll try that too :-)

And could some one please move the Thread to snipplets, extensions and co.!?

Sillium
05-26-2009, 04:51
The new Version also prints out the Cities.

You need another Geo-DB:
http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

Since the Output will be quite a little longer I recommend you send the output to a file like this:

CountryAnalyzer.exe .\GeoLiteCity.dat .\logs > analysed.txt

Sillium
11-25-2009, 04:05
Just to let you know: Works with L4D2 too ;-)

Sillium
06-14-2010, 04:52
Found 2 Null-Pointers

Sillium
06-14-2010, 09:48
Damn... IP counting was incorrect all the time :-/