Friday, June 26, 2009

Webalizer Configuration in Ubuntu

#apt-get install webalizer

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.

Enable the apache2 hostname resolution for this you need to edit /etc/apache2/apache2.conf file and

sudo vi /etc/apache2/apache2.conf

HostnameLookups Off


HostnameLookups On

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

Edit the webalizer.conf file, vi
/etc/webalizer/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 *.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 ''
        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/ and and

Here we have two sites, and, 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/
cp /etc/webalizer.conf /home/

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/
webalizer -q

cd /home/www/
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.

No comments:

Post a Comment