Dec 1, 2011

Webalizer Configuration in Linux

Webalizer Configuration for apache in Linux

            The Webalizer is a GPL application that generates web pages of analysis, from access log. It is simple to configure and easy to run.
RedHat Enterprise Linux

Need to monitor the webserver hits using webalizer.


1)    Install the webalizer rpm

                        # yum install webalizer

2)    Mention the webserver log path in the webalizer configuration file

            # vi /etc/webalizer.conf

            LogFile         /etc/httpd/logs/access_log.2.gz
            OutputDir       /opt/webalizer_apache
            Incremental     yes
            IncrementalName webalizer.current

Note: For my webserver i used logrotate to rotate all my logs. So i mentioned the rotated log file to update the hits. We can mention any webserver access log file (if you didn't have logrotate "/etc/httpd/logs/access_log" will be your default log location of apache webserver). "Incremental"  keyword allows to rotate the logs.

3)    Logrorate script used by me is

            # vi /etc/logrotate.d/apache

            /etc/httpd/logs/*log {
            rotate 20
            /bin/kill -HUP `cat /etc/httpd/logs/ 2>/dev/null` 2> /dev/null || true

Note: If  you want to know more about logrotate refer

4)    Log rotate will rotate the logs in every day morning. So i put one cron entry to update the webserver hits  in the daily basics.

            # crontab -e

            4 30 * * * /usr/local/bin/webalizer -c /etc/webalizer.conf

5)    In that output directory “index.html” file will be there using that we can browse webserver hits history
6)    Or we can add the webalizer output directory to the webserver “Document Root” by creating one symbolic link.

            # ln -s /opt/webalizer_apache /var/www/html/webalizer_apache

Note: Here “/var/www/html” is my “Document Root” in apache web server.

7)    Now we can access the webalizer page from the webserver itself by using the below URL


No comments: