Informations :
Dates
- Publish : : Monday 30 august 2010
- Modification : Thursday 15 october 2020
Share :
Installation AWStats
Script avec 1 ligne
001apt-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
Script avec 24 lignes
001#--------------------------------------------- 002# Pour AWStats 003 004 Alias /awstats/awstats-icon "/usr/share/awstats/icon/" 005 Alias /awstats/awstatscss "/usr/share/awstats/css/" 006 Alias /awstats/awstatsclasses "/usr/share/awstats/classes/" 007 008 ScriptAlias /awstats /usr/lib/cgi-bin/awstats.pl 009 010 <Directory /private/AWStats> 011 012 DirectoryIndex awstats.pl 013 UseCanonicalName off 014 Options +ExecCGI 015 AllowOverride None 016 Order allow,deny 017 Allow from all 018 019 </Directory> 020 021 022 023# Pour AWStats 024#---------------------------------------------
Permet d'avoir à chaque VHOST un dossier ./awstats
avec les stats web.
ex : /etc/awstats/awstats.www.lab3w.com.conf
Script avec 17 lignes
001# Fichier de configuration AWStats 002LogFile="/var/pro/web_logs/lab3w_com/www/logs/access.log" 003LogType=W 004SiteDomain="www.lab3w.com" 005AllowAccessFromWebToAuthenticatedUsersOnly=0 // pour avoir acces au répertoire sans htpassword 006 007AllowToUpdateStatsFromBrowser=0 008AllowFullYearView=3 009 010LogFormat=1 011HostAliases="lab3w.com" 012 013LoadPlugin="ipv6" 014 015LoadPlugin="geoip GEOIP_STANDARD /usr/share/awstats/plugins/GeoIP.dat" 016LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/share/awstats/plugins/GeoLiteCity.dat" 017LoadPlugin="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.
Script avec 8 lignes
001#!/bin/sh 002DIR= 003for f in $(ls -rt {$DIR}access_*-www.lab3w.com.log.gz) ; do 004 echo "$f" 005 gzip -d "$f" 006 /usr/lib/cgi-bin/awstats.pl -config=www.lab3w.com -update -LogFile=${f/.gz/} 007 gzip "${f/.gz/}" 008done
Script avec 1 ligne
001sh 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..
Script avec 4 lignes
001# Plugin: IPv6 AWStats 002# Perl modules required: Net::IP and Net::DNS 003apt-get install libnet-ip-perl 004apt-get install libnet-dns-perl
Script avec 4 lignes
001# Plugin: GeoIP 002# Perl modules required: Geo::IP or Geo::IP::PurePerl (from Maxmind) 003apt-get install libgeoip1 004apt-get install libgeoip-dev
- La page Source Forge AWStats Plugins, contribs and related programs
J'ai écris un script PHP qui permet de récupérer un résumé des informations écritent par AWStats.
- Le script PHP est ici : Show AWStats Statistics in PHP
- La page des résumés AWstats est ici : Resume Analyser Statistics logs files