![]() |
|||||||||||||||||||||||||||
|
This page was last modified: July 28 2006 16:03:27 | ||||||||||||||||||||||||||
The WebalizerWebalizer is a tool for generating website access statistics from log files. The output is in HTML format for easy viewing with a browser... and it is possible to integrate it seemlessly with the existing design of your website. Installation:
cd /usr/ports/www/webalizer/ If you want to be able to see usage by country, you must compile webalizer with the WITH_GEOIP option.:
cd /usr/ports/www/webalizer/ I have separate logfiles for each hosted website, and the following shows how I setup webalizer to analyse each of them. ConfigurationFirst I created a specific folder for statistics on each site:
cd /usr/local/www/domain.tld/ Then I made a configuration file for each site:
cd /usr/local/etc/ This is the content of the above file:
LogFile /usr/local/www/logs/domain.tld-access_log I've included a short explanation of each keyword at the bottom of this page. The first run...If your website has already been available to the world for some time, you probably have access logs that needs to be read by webalizer. If you only have one big logfile, you can just put webalizer to work. But if you rotate your logs, you must initially feed webalizer with data from each log (oldest first). If you read in multiple logfiles, remember to correct the LogFile value in the configuration file between each run. Also if you have been using newsyslog, remove the first an last line in each log indicating when the log was turned over.
webalizer -c /usr/local/etc/webalizer_www.domain.tld.conf Now you can have a look at the newly created HTML files an graphics:
cd /usr/local/www/domain.tld/statistics The number of files created is of course depending on the content of the logfile. Rotating issues...Since I use the incremental option, I don't need to worry too much about when newsyslog rotates the logfiles, but I need to worry about how the logfiles are rotated. If you are not rotating your logs, this is not an issue for you - except of cause the fact that you'r logs will grow huge over time. I don't have that many visitors, so I am rotating my logfiles every month at midnight. Webalizer on the other hand, is running every hour at the 55th minute. This means that I loose 5 minutes of statistics every month - but that is acceptable. The newsyslog entries for rotating each websites logfile, looks like this (all in one line):
/usr/local/www/logs/domain.tld-access.log 644 7 * $M1D0 B The above is rotating logfiles at the start of the first day in each month. The B flag prevents newsyslog from adding 'log file turned over' -messages in the log file, since this could cause an error when webalizer reads the log. Since Apache is very sensitive, newsyslog must gracefully restart Apache when the logfile is turned over. This is accomplished by adding the location of the httpd.pid file, and the signal to use (30). You can read more about it here. Automating webalizerThere is no reason to run webalizer by hand... just put cron to work at let it do the job for you. It is entirely up to you, to decide how often webalizer should update your statistics. I do it every hour at the 55th minute:
55 * * * * www webalizer -c /usr/local/etc/webalizer_www.domain.tld.conf The above is all in one line when editing crontab The reason for choosing the 55th minute of every hour, is that webalizer will then run af few minutes prior to the rotation of the logfiles, which happens once a month. Any errors occurring, will be written to webalizer-error_log, which is a file I have created for this purpose. Tip for handling multiple domains:
for i in usr/local/etc/webalizer*.conf; Now, put this script into crontab, and in the future when adding a new domain, just create the *.conf file and your done. In short...Here is a small summarization of my setup:
Statistics for www.nerdgirl.dk Keywords explained...LogFile OutputDir HistoryName Incremental ReportTitle HostName PageType HTMLPre HTMLHead HTMLBody HTMLPost HTMLTail HTMLEnd HideURL The above is just a small selection of configuration options. If you want to see what else you can do, take a look at /usr/local/share/doc/webalizer/README and man webalizer. |
|||||||||||||||||||||||||||