Generate Apache reports with analog and ReportMagic

Introduction
Apache keeps access logs by default and can be analyzed by Analog. Report Magic can be used to generate nice webpages with the previously gathered statistics. This article will provide a quick-start on how to use both Analog and Report Magic to create statistics about Apache.

Apache
The installation of Apache is out of scope of this article and thus it is assumed that you already have Apache2 installed.

Analog
Install Analog with:

Report Magic
Install Report Magic with:

Configuration
It is highly advised to configure Analog totally your needs first, before continueing with Report Magic.

Analog
The analog configuration file can be found in the directory. The default configuration is quite complete, but needs a little tweaking:

Test analog by running. A bunch of errors may appear but as long as you see a generated report in the next step, you can safely ignore them:

Next step is to take a look at the path you specified with the OUTFILE directive (/var/www/localhost/htdocs/analog/index.html in the example above) and open the file with your browser. If the generated output is what you need (as mentioned before, take a look at the different configuration options and change them to suit your needs), feel free to take the statistics to the next level with Report Magic.

Report Magic
Report Magic takes the data analyzed by Analog and generates html pages instead of Analog. Because of that the Analog configuration has to be changed slightly to output computer readable data instead of human readable data like HTML (which is the default).

Run Analog again with to generate the file. You can check if the file is created succesfully with:

Edit the sample configuration file to your needs and copy to rmagic.ini

Copy to the new destination

Test the new report with

and check the directory specified in the File_In directive and admire the results.

Cron job
You can regularly refresh the log information to always have the latest information available. How often the log analyzer is run depends on your own needs, but it is generally advisable to test how long all jobs run before you add anything to cron.

A good thing to do is to check how long the job takes to run on a busy moment. You can always check with:

If you don't want your screen cluttered with info you don't need, run:

What it does is combine both normal output (on stdin) and error output (on stdout) and pipe them to /dev/null (our virtual garbage can)

After you have chosen how often the cron will run you can easily install it with:

and add the following line