Install and Use The Webalizer to Analyze Apache Web Logs

Table of Contents

Introduction

The Webalizer is a free, open source application for analyzing Apache log files. It provides highly detailed and configurable web usage reports in an HTML format which you can view in a browser. Learn how to install The Webalizer on a 1&1 Cloud Server, and configure the server to automatically run this application at regular intervals in order to update the statistics.

Requirements

  • A 1&1 Cloud Server with Linux (CentOS 7 or Ubuntu 16.04)
  • Apache installed and running

Note: Apache is installed and running on a standard Linux installation by default. If your server was created with a minimum installation, you will need to install and configure Apache before you proceed.

CentOS 7

Update the server's installed packages:

sudo yum update

Install The Webalizer:

sudo yum install webalizer 

Run The Webalizer to analyze the existing Apache log files:

sudo webalizer

By default, the report for the server's primary domain will be saved to /var/www/usage. In order to be able to view this in a browser, open the site's main Apache configuration file for editing:

sudo nano /etc/apache2/sites-available/000-default.conf

Add the following alias:

Alias "/usage" "/var/www/usage"

Save and exit the file. Then restart Apache for the changes to take effect:

sudo systemctl restart httpd

You will now be able to view The Webalizer reports at http://example.com/usage.

Ubuntu 16.04

Update the server's installed packages:

sudo apt-get update

Install The Webalizer:

sudo apt-get install webalizer

Run The Webalizer to analyze the existing Apache log files:

sudo webalizer

By default, the report for the server's primary domain will be saved to /var/www/webalizer. In order to be able to view this in a browser, open the site's main Apache configuration file for editing:

sudo nano /etc/apache2/sites-available/000-default.conf

In the first line, the following information is displayed:

<VirtualHost *:80>

Add the following alias:

Alias "/webalizer" "/var/www/webalizer"

Save and exit the file. Then restart Apache for the changes to take effect:

sudo systemctl restart apache2

You will now be able to view The Webalizer reports at http://example.com/webalizer.

Add The Webalizer to Cron

Cron is a Linux utility which runs commands at the specified intervals. Open the crontab file for editing:

sudo crontab -e

Add the following line to this file to run the webalizer command once an hour:

0 * * * *      /usr/bin/webalizer

Save and exit the file.

Comments

Tags: Apache