Debianhelp.co.uk
 

Webalizer Configuration in Debian

What is Webalizer?

The Webalizer is a fast, free web server log file analysis program. It produces highly detailed, easily configurable usage reports in HTML format, for viewing with a standard web browser

If you want to install webalizer in  Debian Use the following command

#apt-get install webalizer

This will lead you through some basic questions by using debconf to prompt for answers. Use all the default locations.

By default the package will install a daily cron job which will cause the system to process the logfiles once a day, it will always run after the default Apache logfile rotation, which means that instead of examining the logfile /var/log/apache2/access.log it will use the previous one /var/log/apache2/access.log.1.

To configure the software you must look at the global file /etc/webalizer.conf.
Configure the /etc/webalizer.conf file.

Edit the webalizer.conf file, vi /etc/webalizer.conf and add/change in this file:

LogFile /var/log/apache2/access.log

OutputDir /home/www/webalizer

Incremental  yes

PageType  htm*

PageType  cgi

PageType  php

HideURL  *.gif

HideURL  *.GIF

HideURL  *.jpg

HideURL  *.JPG

HideURL  *.ra

IgnoreURL  /taskbar*

This tells the webalizer.conf file to set itself up for this particular configuration setup with:

LogFile /var/log/apache2/access.log

The option LogFile specifies the logfile to use with Webalizer. The default log file is supposed to be the access_log of Apache Web Server, but you can specifies a different one, like the one Squid Proxy Server makes named access.log if you use it in httpd-accelerator mode.
 
OutputDir /home/www/webalizer

The option OutputDir specifies the location of the output directory to use for the reports of Webalizer. All present and future report files generated by the Webalizer program will be hosted in this directory. It is recommended that you create this directory where your Apache web site resides.

Incremental yes

The option Incremental if set to Yes tells the program only to process partial logs file, and allows you to rotate your log files as much as you want without the loss of access information. It's recommended to set this option to Yes.

PageType htm* cgi php

The option PageType specifies what file extensions you want Webalizer to consider as a page to count. Each added file extensions must be specified on its own line as shown in the Webalizer configuration file above.

HideURL *.gif *.GIF *.jpg *.JPG *.ra

The option HideURL specifies what kind of items such as graphic files, audio files or other non-html files to hide from the reports page. Each added item must be specified on its own line as shown in the Webalizer configuration file above.

IgnoreURL /taskbar*

The option IgnoreURL specifies URLs to be completely ignored from the generated statistics reports. This option can be used to ignore directories that are not important in our statistics reports. It's also useful when you want to manage and class which URLs should be monitored and which should be ignored.
 
After configuring all the required options .Now you need to restart the Apache2 server using
 
/etc/init.d/apache2 restart

Running Webalizer manually first time

Now it's time to run the program to generate reports, html and graphics in the default Webalizer directory so that we can see them in our web browser interface. This step is required just the first time you install and use Webalizer, since it's preferable to use a cron job to automate this task in the future. To run Webalizer manually, to generate reports, use the following command:

 

        [root@test ] /# /usr/bin/webalizer
        Webalizer V1.30-04 (Linux 2.2.27) English
        Using logfile /var/log/apache2/access.log
        Creating output in /home/www/webalizer
        Hostname for reports is 'sites.test.com'
        History file not found...
        Previous run data not found...
        Saving current run data... [03/07/2005 04:42:03]
        Generating report for April 2005
        Generating summary report
        Saving history information...
        81 records (2 ignored) in 0.31 seconds

 

At this stage, we should verify that Webalizer is working on the system. To do that, point your web browser to the following address: http://my-web-server/webalizer/. The my-web-server is the address where your Apache web server lives, and usage is the directory that host all the Webalizer reports files.

 

This works well for single sites, but if you have a group of websites all on the same machine you might need to make some changes.


The way that you handle multiple websites on one host is to place all the files beneath a common directory /home/www, such as:


/home/www/


www.domain1.com/logs/ and www.domain1.com/stats
www.domain2.com/logs and www.domain2.com/stats


Here we have two sites www.domain1.com, and www.domain2.com, each has its own logs,stats/ subdirectory where Apache places the logfiles and stat files.


To handle this simply you merely copy the default webalizer.conf file from /etc into each of the log directories:


cp /etc/webalizer.conf /home/www.domain1.com/logs
cp /etc/webalizer.conf /home/www.domain2.com/logs


Now if you make the changes to the configuration file so that each one has:


Logfile   access.log
OutputDir ../stats/


You can update the stats by running:


cd /home/www/www.domain1.com/logs
webalizer -q


cd /home/www/www.domain2.com/logs
webalizer -q


(The -q flag merely makes the program run quietly).


These two commands can be placed inside a shell script and invoked automatically be a cron job belonging to a user who can write to the stats directory - and you can remove the default job by running:


rm /etc/cron.daily/webalizer
 
Webalizer Webmin Module Installation


This module allows webmin (a web-based interface for system administration for Unix) to configure the webalizer HTTP server log file analyzer.For webmin installation in debian click here


If you want to install the webmin module for this in debian run the  following command from your shell


#apt-get install webmin-webalizer


After finishing the installation login in to your webmin and check for webalizer now you can change all the required configuration options.