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.
If you have not used access logs before, you might need to enable them. From the Control Panel, 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
We'll chose ~/www/logs/ as the target directory where the Webalizer output will be generated. Create the directory as needed, and make it accessible from the web by setting up a symbolic link from one of your domains. To make the Webalizer content accessible from, say, http://mydomain.ext/logs, you would do:
$ mkdir ~/www/logs $ cd ~/www/mydomain.ext $ ln -s ~/www/logs
Note: You may wish to protect this area using passwords or some other authentication method. See the htaccess guide for details on how this is done.
Copy the sample Webalizer configuration file to the target directory:
$ cd ~/www/logs $ 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
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 (which you can define by setting
the $EDITOR
environment variable).
To create an entry, insert the line:
@weekly (cd $HOME/www/logs && webalizer -pQ)
To update the statistics right away, you can also run the command from your shell:
$ (cd /logs/myself webalizer -p)
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