30.3. Configure the /etc/webalizer.conf file

The /etc/webalizer.conf is the default configuration file for Webalizer. With it, you can specify which directories or pages in your web site to analyze, which URLs to hide, and so on. By default, the Webalizer program will install a sample configuration file named webalizer.conf.sample under the /etc/ directory of Linux. You can use this file to configure your choices and then rename it webalizer.conf, and the Webalizer program will be able to find and use it. A lot of options exist and it's important to read the documentation that comes with Webalizer for more information on all of the different setting and parameters. Also, it's important to note that we comment in this Webalizer configuration file only the most common and used parameters.

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


        LogFile /var/log/httpd/access_log
        OutputDir /home/httpd/usage
        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/httpd/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. See, Software -Server/Proxy Network, for more information.

OutputDir /home/httpd/usage

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.

Caution

If you decide to use the existent /etc/webalizer.conf.sample file to configure your parameters for Webalizer, don't forget to rename it webalizer.conf or the program will be unable to use it.