Apache::AppWrap::DBILogConfig - Logs access information in a DBI database
In httpd.conf
PerlLogHandler Apache::DBILogConfig PerlSetVar DBILogConfig_table mysite_log PerlSetVar DBILogConfig_log_format "%b=bytes_sent %f=filename %h=remote_host %r=request %s=status"
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. (Some documentation has been borrowed from the mod_log_config documentation. The core module is derived from the original to be found on CPAN. This version is not compatible with the CPAN version.)
The existing database handle is reused, so a connect string, user name and password need not be supplied.
If 'DBILogConfig_table' is specified in httpd.conf it is used. Otherwise a table name may be specified in table my_defaults. If neither is defined, the table for logging accesses by default is called 'accesses'.
A format string consists of a string with the following syntax:
%[conditions][{parameter}]format=field
Formats specify the type of data to be logged. The following formats are accepted:
strftime(3)
format.
A database column to log the data to
For formats that take a parameter
Example: %{DOCUMENT_ROOT}e
Conditions are a comma-separated 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 statements will be written to the error log if LOGLEVEL is set to 'warn' or higher
CREATE TABLE accesses ( id mediumint(9) DEFAULT '0' NOT NULL auto_increment, bytes mediumint(9) DEFAULT '0' NOT NULL, user varchar(15), status smallint(6) DEFAULT '0' NOT NULL, timeserved datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, urlpath varchar(200) DEFAULT '' NOT NULL, querystring text, useragent varchar(250), PRIMARY KEY (id) );
After installing and configuring this module, Apache will continue to log to your regular access log file (if it was previously configured that way). To log accesses only to your database comment out CustomLog or TransferLog or set them to /dev/null.
Copyright (C) 1998, Jason Bodnar <jason@shakabuku.org>. All rights reserved.
This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
perl(1), mod_perl(3)