How to set up geography-related plug-ins for AWStats.
AWStats has several geography plug-in options. Country, region, city level. They are much faster than using a reverse DNS lookup though DNS lookup gives you a host name for the IP address if it can.
1. Install Geo::IP::PurePerl script which is used for country and city plug-ins. This depends on the version of Perl you have. To find the version of Perl, see the acquire tutorial step.
use Geo::IP::PurePerl; my $gi = Geo::IP::PurePerl->new(GEOIP_STANDARD); print $gi->country_name_by_name("www.smartlabsoftware.com");
use strict; use Geo::IP::PurePerl; my $gi = Geo::IP::PurePerl->open("d:/dev/aw/geodb/GeoLiteCity.dat",GEOIP_STANDARD); my $addr = "www.smartlabsoftware.com"; print $gi->country_name_by_name($addr); my @mydata = $gi->get_city_record($addr); print "addr is in city: $mydata[4] and region: $mydata[3]";
This is a script that downloads the GeoIP.dat and GeoLiteCity.dat files, installs them, then deletes the compressed version. This script can be run monthly using Windows task manager. Change the LOCALPATH variable for yours.
1. Install wget for Windows in the mytools directory The install process creates a wget directory.
rem rem Download geo databases for AWStats rem set LOCALPATH="d:\dev\aw" rem rem -S keep date of file modification rem "%LOCALPATH%\mytools\wget\wget.exe" -S --output-document="%LOCALPATH%\geodb\GeoLiteCity.dat.gz" "http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz" "%LOCALPATH%\mytools\wget\wget.exe" -S --output-document="%LOCALPATH%\geodb\GeoIP.dat.gz" "http://www.maxmind.com/download/geoip/database/GeoIP.dat.gz" rem rem -d = unzip rem -f = force rem -v = verbose rem "%LOCALPATH%\mytools\gzip.exe" -dfv "%LOCALPATH%\geodb\GeoLiteCity.dat.gz" "%LOCALPATH%\mytools\gzip.exe" -dfv "%LOCALPATH%\geodb\GeoIP.dat.gz"
You can verify the databases were updated by viewing the Date modified column when you view the directory in details mode.