Awstats
De Teteve wiki
Révision datée du 26 mars 2017 à 11:41 par Teteve (discussion | contributions)
En cours de mise en place et d'approfondissement...
Installation
# apt-get install awstats
Définir l'alias utilisé par les différents domaines :
# vim /etc/apache2/sites-available/stats.conf
Alias /awstatsclasses "/usr/share/awstats/classes/" Alias /awstatscss "/usr/share/awstats/css/" Alias /awstats-icon "/usr/share/awstats/icon/" ScriptAlias /stats /usr/lib/cgi-bin/awstats.pl # mêmes paramètres que dans awstats.*.conf <Directory /usr/lib/cgi-bin/> DirectoryIndex awstats.pl UseCanonicalName off AuthType Digest AuthName "Acces restreint aux stats" AuthDigestDomain /awstats http://www.teteve.fr/awstats AuthDigestProvider file AuthUserFile /etc/apache2/.awstats.pwd Require valid-user Options +ExecCGI AllowOverride None Order allow,deny Allow from all </Directory>
# a2ensite stats.conf Enabling site stats. To activate the new configuration, you need to run: service apache2 reload # service apache2 reload
Je n'explique pas le fonctionnement du "AuthDigestDomain" : ça fonctionne pour tous les sites : www.mondomaine.fr/awstats avec le même et unique fichier de conf...
recopier le fichier de conf par défaut :
# cp /etc/awstats/awstats.local.conf /etc/awstats/awstats.www.teteve.fr.conf
Config
EN COURS...
Extrait de mon fichier de config, à rapprocher de la Conf d'Apache et des vhosts...
LogFile="/var/log/apache2/log/teteve.log" LogType=W J'ai barré les variables ne correspondant pas à un serveur web. A reprendre dans le cas d'un autre type de serveur. # Enter here your log format (Must match your web server config. See setup # instructions in documentation to know how to configure your web server to # have the required log format). # Possible values: 1,2,3,4 or "your_own_personalized_log_format" # 1 - Apache or Lotus Notes/Domino native combined log format (NCSA combined/XLF/ELF log format) # 2 - IIS or ISA format (IIS W3C log format). See FAQ-COM115 For ISA. # 3 - Webstar native log format. # 4 - Apache or Squid native common log format (NCSA common/CLF log format) # With LogFormat=4, some features (browsers, os, keywords...) can't work. # "your_own_personalized_log_format" = If your log is ftp, mail or other format, # you must use following keys to define the log format string (See FAQ for # ftp, mail or exotic web log format examples): # %host Client hostname or IP address (or Sender host for mail log)# %host_r Receiver hostname or IP address (for mail log)# %lognamequot Authenticated login/user with format: "john" # %logname Authenticated login/user with format: john # %time1 Date and time with format: [dd/mon/yyyy:hh:mm:ss +0000] or [dd/mon/yyyy:hh:mm:ss] # %time2 Date and time with format: yyyy-mm-dd hh:mm:ss # %time3 Date and time with format: Mon dd hh:mm:ss or Mon dd hh:mm:ss yyyy # %time4 Date and time with unix timestamp format: dddddddddd # %methodurl Method and URL with format: "GET /index.html HTTP/x.x" # %methodurlnoprot Method and URL with format: "GET /index.html" # %method Method with format: GET # %url URL only with format: /index.html # %query Query string (used by URLWithQuery option) # %code Return code status (with format for web log: 999) # %bytesd Size of document in bytes # %refererquot Referer page with format: "http://from.com/from.htm" # %referer Referer page with format: http://from.com/from.htm # %uabracket User agent with format: [Mozilla/4.0 (compatible, ...)] # %uaquot User agent with format: "Mozilla/4.0 (compatible, ...)" # %ua User agent with format: Mozilla/4.0_(compatible...) # %gzipin mod_gzip compression input bytes: In:XXX # %gzipout mod_gzip compression output bytes & ratio: Out:YYY:ZZpct. # %gzipratio mod_gzip compression ratio: ZZpct. # %deflateratio mod_deflate compression ratio with format: (ZZ)# %email EMail sender (for mail log)# %email_r EMail receiver (for mail log)# %virtualname Web sever virtual hostname. Use this tag when same log # contains data of several virtual web servers. AWStats # will discard records not in SiteDomain nor HostAliases # %cluster If log file is provided from several computers (merged by # logresolvemerge.pl), use this to define cluster id field. # %extraX Another field that you plan to use for building a # personalized report with ExtraSection feature (See later). # If your log format has some fields not included in this list, use: # %other Means another not used field # %otherquot Means another not used double quoted field # # Examples for Apache combined logs (following two examples are equivalent): # LogFormat = 1 # LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot" # # Example for IIS: # LogFormat = 2 # LogFormat = %virtualname %host %logname %time1 %methodurl %code %bytesd %refererquot %uaquot LogFile="/var/log/apache2/vhosts/teteve.log" LogType=W LogFormat = %virtualname %host %logname %time1 %methodurl %code %bytesd %refererquot %uaquot LogSeparator=" "
J'ai été obligé de rajouter %bytesd sinon awstats refuse d'analyser les logs. De même, je n'ai pas réussi à faire passer un "virtualname:port"
Commande
Pour lancer l'update manuellement (ou à rajouter dans un cron...)
/usr/lib/cgi-bin/awstats.pl -config=www.teteve.fr