NAME

Apache::Log::Spread - Perl implementation of mod_log_spread for multicasting access logs.

SYNOPSIS

# In httpd.conf PerlModule Apache::Log::Spread PerlLogHandler 'Apache::Log::Spread->handler' SpreadDaemon 4903 MLS_LogFormat "%h %{$cookie->isVisitor?'V':'U'}perl %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" custom MLS_Log www custom

DESCRIPTION

Apache::Log::Spread provides logging handlers to allow for Apache access logs to be multocast to a spread group. The configuration interface is a super-set of the Apache mod_log_config interface and allows for expansion of perl code.

Configuration Directives

SpreadDaemon port[@host]

The location of the spread daemon to connect to.

MLS_LogFormat formatstring formatname

formatstring is a standard mod_log_config format line, the standard format options are all accepted (see the mod_log_config documentation for details), as well as the special tag %{...code...}perl, which evals the contained code and substitutes the results for the format specifier.

MLS_Log groupname formatname [should_print]

groupname is the name of the spread group to which logs should be multicast. formatname is the name of the MLS_LogFormat to use. should_print is an optional environment string to toggle transmission of logs. This can be used the way that mod_setenvif environment variables are used, or with a complete code block. For example, to only multicast requests for '.html' files we can use:

MLS_Log www custom "return ($r->uri =~ /\.html/) || ($r->uri =~ /$\//));"

EXTENDING

Apache::Log::Spread is deigned to be extended to provide custom format string expansions. To extend it in ithis fashion, simply override the _interpolate_log_string function.

An example is

    package My::SpreadLogger; use strict;

    use Apache::Logger::Spread; use My::Cookies;

    use vars qw( @ISA); @ISA = qw(Logger::Spread);

    sub handler($$) { my $self = shift; my $ar = shift; Apache::Log::Spread::handler($self, $ar); }

    sub _interpolate_log_string { my ($self, $logref) = @_; my $cookie = My::Cookie->new(); $$logref =~ s/%\{([\w-]+)\}cookie/$cookie->{$1} || '-'/ego; }

AUTHOR

George Schlossnagle <george@omniti.com>