Informations :
Dates
- Publish : : Monday 30 august 2010
- Modification : Thursday 15 october 2020
Share :
Installation AWStats
apt-get install awstats
Les fichiers de configuration se trouvent dans le répertoire /etc/awstats/
, awstats.conf
- awstats.siteweb.conf
par les fichiers des sites Web par exemple.
Par default, sous Linux Debian, les données et pages html se trouvent : /var/lib/awstats/
Configuration Apache
#--------------------------------------------- # Pour AWStats Alias /awstats/awstats-icon "/usr/share/awstats/icon/" Alias /awstats/awstatscss "/usr/share/awstats/css/" Alias /awstats/awstatsclasses "/usr/share/awstats/classes/" ScriptAlias /awstats /usr/lib/cgi-bin/awstats.pl < Directory /private/AWStats > DirectoryIndex awstats.pl UseCanonicalName off Options +ExecCGI AllowOverride None Order allow,deny Allow from all < /Directory > # Pour AWStats #---------------------------------------------
Permet d'avoir à chaque VHOST un dossier ./awstats
avec les stats web.
ex : /etc/awstats/awstats.www.lab3w.com.conf
# Fichier de configuration AWStats LogFile="/var/pro/web_logs/lab3w_com/www/logs/access.log" LogType=W SiteDomain="www.lab3w.com" AllowAccessFromWebToAuthenticatedUsersOnly=0 // pour avoir acces au répertoire sans htpassword AllowToUpdateStatsFromBrowser=0 AllowFullYearView=3 LogFormat=1 HostAliases="lab3w.com" LoadPlugin="ipv6" LoadPlugin="geoip GEOIP_STANDARD /usr/share/awstats/plugins/GeoIP.dat" LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/share/awstats/plugins/GeoLiteCity.dat" LoadPlugin="geoip_asn_maxmind GEOIP_STANDARD /usr/share/awstats/plugins/GeoIPASNum.dat"
Si on a plusieurs fichiers de access_serv1-www.lab3w.com.log.gz
, access_serv2-www.lab3w.com.log.gz
on peut utiliser ceci : analyse.sh
Les fichiers GZ, sont GunZipés par exemple tous les jours à la fin de journée ; une fois la journée terminée et les fichiers "backupés", on génère les AWStats des servers.
#!/bin/sh DIR=$1 for f in $(ls -rt {$DIR}access_*-www.lab3w.com.log.gz) ; do echo "$f" gzip -d "$f" /usr/lib/cgi-bin/awstats.pl -config=www.lab3w.com -update -LogFile=${f/.gz/} gzip "${f/.gz/}" done
sh analyse.sh /var/pro/web_logs/lab3w_com/www/logs/
Une fois la commande exécutée... les fichiers sont stockés dans le répertoire : /var/lib/awstats/
au nom du VHOST correspondant. Vous pouvez ajouter une tâche planifiée tout les jours ou toutes les 5 minutes ;)
CF : http://awstats.sourceforge.net/docs/awstats_config.html
Pour installer les plugins IPv6 et GeoIP, il faut installer GeoIP.dat.gz GeoLiteCity.dat.gz etc..
# Plugin: IPv6 AWStats # Perl modules required: Net::IP and Net::DNS apt-get install libnet-ip-perl apt-get install libnet-dns-perl
# Plugin: GeoIP # Perl modules required: Geo::IP or Geo::IP::PurePerl (from Maxmind) apt-get install libgeoip1 apt-get install libgeoip-dev