The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Apache::DBILogConfig - Logs access information in a DBI database

SYNOPSIS

 # In httpd.conf
 PerlLogHandler Apache::DBILogConfig
 PerlSetVar DBILogConfig_data_source DBI:Informix:log_data
 PerlSetVar DBILogConfig_username    informix
 PerlSetVar DBILogConfig_password    informix
 PerlSetVar DBILogConfig_table       mysite_log
 PerlSetVar DBILogConfig_log_format  "%b=bytes_sent %f=filename %h=remote_host %r=request %s=status"

DESCRIPTION

This module replicates the functionality of the standard Apache module, mod_log_config, but logs information in a DBI-compliant database instead of a file.

LIST OF TOKENS

DBILogConfig_data_source

A DBI data source with a format of "DBI::driver:database"

DBILogConfig_username

Username passed to the database driver when connecting

DBILogConfig_password

Password passed to the database driver when connecting

DBILogConfig_table

Table in the database for logging

DBILogConfig_log_format

A string consisting of formats seperated by white space that define the data to be looged (see FORMATS below)

FORMATS

A format consists of a string with the following syntax:

%[conditions][{parameter}]format=field

format

Formats specify the type of data to be logged. The following formats are accepted:

b Bytes sent
f Filename
e Environment variable (specified by parameter)
h Remote host
a Remote IP Address
i Header in the client request (specified by parameter)
l Remote log name (from identd)
n Contents of a note from another module (specified by parameter)
o Header from the reply (specified by parameter)
p Server port
P Apache child PID
r First line of the request
s Request status
t Time in common log format (default) or strftime() (parameter)
T Time taken to serve request
u Remote user from auth
U URL
v Server hostname

field

A database column to log the data to

parameter

For formats that take a parameter

Example: %{DOCUMENT_ROOT}e

conditions

Conditions are a comma-seperated list of status codes. If the status of the request being logged equals one of the status codes in the condition the data specified by the format will be logged. By placing a '!' in front of the conditions, data will be logged if the request status does not match any of the conditions.

Example: %!200,304,302s=status will log the status of all requests that did not return some sort of normal status

DEBUGGING

Debugging statements will be written to the error log if LOGLEVEL is set to 'warn' or higher

PREREQUISITES

  • mod_perl >= 1.11_01 with PerlLogHandler enabled

  • DBI

  • Date::Format

INSTALLATION

To install this module, move into the directory where this file is located and type the following:

        perl Makefile.PL
        make
        make test
        make install

This will install the module into the Perl library directory.

Once installed, you will need to modify your web server's configuration as above.

AUTHOR

Copyright (C) 1998, Jason Bodnar <jcbodnar@mail.utexas.edu>. All rights reserved.

This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1), mod_perl(3)