Application AWStats

From campisano.org
Jump to navigation Jump to search

Install

  • AWStats will use legacy geoip database to extract countries data
apt-get install -y libgeo-ip-perl
apt-get clean
mkdir -p /srv/stats/awstats/passwd
htpasswd -c /srv/stats/awstats/passwd/awstats USERNAME  # type user password on prompt
mkdir -p /srv/stats/awstats/data
chown www-data:www-data /srv/stats/awstats/data
cd /srv/stats
curl -O https://src.fedoraproject.org/lookaside/pkgs/GeoIP/GeoIP.dat.gz/508e3c10da15f2722774cf4014863976/GeoIP.dat.gz
gzip -d GeoIP.dat.gz
curl -O https://src.fedoraproject.org/lookaside/pkgs/GeoIP/GeoLiteCity.dat.gz/2ec4a73cd879adddf916df479f3581c7/GeoLiteCity.dat.gz
gzip -d GeoLiteCity.dat.gz
curl -O https://src.fedoraproject.org/lookaside/pkgs/GeoIP/GeoIPASNum.dat.gz/f8ed8b468ecee0f7a98cb05c33af7b14/GeoIPASNum.dat.gz
gzip -d GeoIPASNum.dat.gz
cd /srv/stats/awstats
curl -O https://ufpr.dl.sourceforge.net/project/awstats/AWStats/7.7/awstats-7.7.tar.gz
tar -xzf awstats-7.7.tar.gz
rm -f awstats-7.7.tar.gz
chown root:root -R awstats-7.7
cat > awstats-7.7/wwwroot/cgi-bin/awstats.www.campisano.org.conf << 'EOF'
LogFile="/dev/null"
LogFormat=1
SiteDomain="WWW.YOURDOMAIN.ORG"
HostAliases="localhost 127.0.0.1"
DNSLookup=2
DynamicDNSLookup=2
DirData="/srv/stats/awstats/data"
DirIcons="/awstats/icon"
AllowFullYearView=3
AllowAccessFromWebToAuthenticatedUsersOnly=1
LoadPlugin="tooltips"
#LoadPlugin="decodeutfkeys"                                                     # REQUIRED MODULES: Encode and URI::Escape
LoadPlugin="hashfiles"                                                          # REQUIRED MODULES: Storable
LoadPlugin="graphgooglechartapi"
LoadPlugin="geoip GEOIP_STANDARD /srv/stats/GeoIP.dat"                          # REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /srv/stats/GeoLiteCity.dat"       # REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
LoadPlugin="geoip_asn_maxmind GEOIP_STANDARD /srv/stats/GeoIPASNum.dat"         # REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
EOF

Usage

su -s /bin/bash -c '/srv/stats/awstats/awstats-7.7/wwwroot/cgi-bin/awstats.pl -config=WWW.YOURDOMAIN.ORG -update -showsteps -showcorrupted -showdropped -LogFile=access_log' - www-data

Configure UI

a2enmod cgid
  • edit http site conf file
        Alias /awstats "/srv/stats/awstats/awstats-7.7/wwwroot/"
        <Directory "/srv/stats/awstats/awstats-7.7/wwwroot/">
                AllowOverride None
                AuthType Basic
                AuthName "Restricted Files"
                AuthBasicProvider file
                AuthUserFile "/srv/stats/awstats/passwd/awstats"
                Require valid-user
        </Directory>

        ScriptAlias /awstats-bin "/srv/stats/awstats/awstats-7.7/wwwroot/cgi-bin/"
        <Directory "/srv/stats/awstats/awstats-7.7/wwwroot/cgi-bin/">
                <IfModule mod_fcgid.c>
                        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                </IfModule>
        </Directory>

And now use site.dmn/awstats-bin/awstats.pl

Note

AWStats takes few minutes and insignificant memory to parse 2GB of combined Apache log, and produces less than 10MB of processed text files.