Statistiques d'utilisation avec Webalizer

Your website activity is recorded in a "raw" log file (under /logs/ which is updated in real-time. To process this information and display it in a convenient way, a log analysis tool can be used. One such web analyzer is the Webalizer utility which is standard on our servers.

Making sure your logs are enabled

If you have not used access logs before, you might need to enable them. From the web interface, look for "Web error logs" under the Preferences / Server Settings section. You can also enable access logs from the shell interface using:

  # Enable HTTP log file
  csoftadm> conf set logs yes
  
  # Enable HTTPS log file
  csoftadm> conf set ssl-acclog yes
Configuring webalizer

Copy the sample Webalizer configuration file (/etc/webalizer.conf on OpenBSD or /usr/local/etc/webalizer.conf-dist on FreeBSD) to your /logs/ directory:

  $ cd /logs/myself
  $ cp /etc/webalizer.conf .

Open up webalizer.conf in your favorite text editor, and edit at least the following entries:

  # The path to your access log file (for shared web server users)
  LogFile /logs/myself/http
  
  # The path to your access log file (for Advanced/Corporate users)
  #LogFile /logs/myself/httpd
  
  # Where to place the generated documents.
  OutputDir /home/myself/www/logs
  
  # Name to use in the title
  HostName www.mydomain.ext
  # Use GeoIP for geolocation
  GeoIP yes
  # Path to GeoIP database
  GeoIPDatabase /usr/local/share/GeoIP/GeoIP.dat
Creating the OutputDir

Create the directory where the generated documents will go:

  $ mkdir $HOME/www/logs

You will probably want to protect this area using passwords or some other authentication method. See the htaccess guide for details on how this is done.

Updating the statistics automatically

Now add an entry to your crontab to periodically update the statistics:

  $ crontab -e

If you are not familiar with the crontab utility, the previous command will start up your favorite text editor (as dictated by $EDITOR). Simply insert the line:

  @weekly (cd /logs/myself && webalizer -Q)

To update the statistics right away, you can also run the command from your shell:

  $ (cd /logs/myself webalizer -q)
Enabling automatic log rotation

Logfile rotation may be enabled from csoftadm. The logs_rotate option accepts a comma-separated list of logfiles which should be rotated ("logs", "ssl-acclog", "errlog" or "ssl-errlog"). The logs_size setting specifies to rotate by size (specified in KB). Alternatively, the logs_when setting can be used to rotate by time interval. The maximum number of archived logs is specified by logs_count.

  # Rotate HTTP log file only
  csoftadm> conf set logs_rotate logs
  
  # Set limit to 100,000 KB
  csoftadm> conf set logs_size 100000
  
  # Set archived log file count
  csoftadm> conf set logs_count 4
Links

Ce site web - © 2012 Hébergement Csoft.net, Inc.
(Nous Rejoindre) (Politique de Confidentialité)
  LPF Valid HTML 4.01 Transitional