Skip to content
Stefan Heumader edited this page Jun 2, 2013 · 12 revisions

Welcome to the ApacheLog wiki!

Description

ApacheLog is a Collectd Plugin, which analyses hit and traffic for specific domains based on the Apache logfile.

Installation and Configuration

Installation

Copy the ApacheLog.pm from the Git repository to a directory of your choice (i.e. /usr/local/bin/) or simply clone the repository by executing git clone https://geuma@github.com/geuma/ApacheLog.git.

ApacheLog Configuration

To configure the ApacheLog Perl Module, edit the configuration hash in the beginning of the ApacheLog.pm file by setting the following keys to their correct values:

  • LogFile: specify the path of the Apache logfile. Additionally the log format for each virtual host in Apache configuration has to be set to CustomLog /var/log/apache2/access.log "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
  • TmpFile: specify the path to a temporary file, which will be used by ApacheLog to keep track of already evaluated log events
  • Domains: specify an anonymous array of Domains, which should be evaluated

A small example is listed below:

my $config =
{
    LogFile => '/var/log/apache2/access.log', # path to the access log file of apache
    TmpFile => '/tmp/collectd-apachelog.tmp', # path for the temporary file of this plugin
    Domains => [
        'website1.urandom.at',
        'website2.urandom.at',
    ], # anonymous array for domains, which should be evaluated
};

Collectd configuration

To configure Collectd to use ApacheLog Perl Module, edit the configuration file of Collectd (i.e. /etc/collectd/collectd.conf) by adding the following lines. Please ensure to set IncludeDirto your installation directory.

LoadPlugin perl
<Plugin perl>
    IncludeDir "/usr/local/bin"
    LoadPlugin "ApacheLog"
</Plugin>