Oct 122012
 

AWStats is a log analyzer application written in Perl, that summarizes valuable information about the traffic received by a web server, and displays it in a web frontend with data in tables and graphs.

This post explains how to install and configure AWStats in an apache web server running on a linux (Debian)  machine. The official documentation of AWStats is available at http://awstats.sourceforge.net/docs/

Continue reading »

 Posted by at 9:39 am
Jun 052012
 

There are some good open source tools, such as AWStats, that perform an in-depth analysis of the information in the access logs of a web server.

We will dedicate another post to talk about the possibilities of AWStats, and how to install and configure it.

However, sometimes we may be interested in and ad-hoc processing of the log files of our web server, to extract information specific to the structure of our site, in a way that is not covered by a generic tools such as AWStats.

In this post we will explain how to perform this kind of processing by means of a home-made perl script.

Continue reading »

 Posted by at 4:19 pm
Apr 212012
 

(Leer este artículo en español)

In an Apache web server installation in Linux, by default accesses are recorded in a file named access.log in the directory /var/log/apache2.

In the same way, errors are recorded in a file named ‘error.log’ under the same directory.

The problem is that these files keep growing, and this makes difficult the management and analysis of the information in them.

To fix this issue, we can configure the web server to create a new file every day.

The apache config file for our virtual server www.openalfa.com is located in the path ‘/etc/apache2/conf/sites_enabled/001-openalfa’.
Inside this file, in the <VirtualHost> section for this server, we add the directives:

As you can see, we make use of the pipe (“|”) character to redirect to the ‘rotatelogs’ utility the logs of accesses and errors .

The first argument of rotatelogs is the name of the destination file. It uses the parameters %Y, %m, etc. to include the date and time of creation as part of the filename.

The second argument (the number 86400) is the number of second in one day (86400 = 24 * 60 * 60).

Once the configuration file has been edited, we only need to restart the web service to force  the apache server to read the new configuration:

 Posted by at 2:33 pm