Lloyd Richardson


Apache::Bwlog - Vhost bandwidth logger for mod_perl.


  Place this in the httpd.conf file :
  PerlLogHandler Apache::Bwlog

  Apache Directives
  • PerlSetVar Bwlog active

            This value is required if plan to use the module at all.  This can be placed globally
            to effect all virtual hosts on the machine, or in a single VirtualHost context which 
            only activates logging for that host
  • PerlSetVar Bwlog_threshold <bytes>

            Set the "bitbucket" maximum before purging the current counter.  Be aware that setting
            this value to low can add a lot of disk I/O, and or CPU time.  For a high volume site 
            a large number is recommended here.  Defaults to 100,000 bytes.
  • PerlSetVar Bwlog_logtype <type>

            Valid types are currently "file" and "mysql".  The mysql portion requires the directives
            described below.
  • PerlSetVar Bwlog_mysql_user

  • PerlSetVar Bwlog_mysql_password

  • PerlSetVar Bwlog_mysql_server

  • PerlSetVar Bwlog_mysql_database

  • PerlSetVar Bwlog_mysql_tablename

  • PerlSetVar Bwlog_logdir <directory>

            Resets the value for where your vhost bwlogs are stored if the file option is chosen. 
            This option defaults to : /usr/local/apache/logs

Table Create Syntax For mysql driver

        The following create will work for the mysql database :
        CREATE TABLE `bw_log` (
          `bw_id` bigint(20) NOT NULL auto_increment,
          `vhost` varchar(100) NOT NULL default '',
          `bytes_sent` bigint(20) NOT NULL default '0',
          `time_stamp` timestamp(14) NOT NULL,
          PRIMARY KEY (`bw_id`)


        httpd.conf Example.

        PerlLogHandler Apache::Bwlog

        PerlSetVar Bwlog_mysql_user bw_user
        PerlSetVar Bwlog_mysql_password bw_password
        PerlSetVar Bwlog_mysql_server
        PerlSetVar Bwlog_mysql_database bw_logger
        PerlSetVar Bwlog_mysql_tablename bw_log
        PerlSetVar Bwlog active
        PerlSetVar Bwlog_threshold 100000
        PerlSetVar Bwlog_logtype mysql


  This module will do per virtual host bandwidth logging.  Fun fun fun.


None by default.


 mod_perl, perl, apache


Lloyd Richardson lloyd@drlabs.org


Copyright 2004 by Lloyd Richardson <lloyd@drlabs.org>

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

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 199:

'=item' outside of any '=over'

Around line 234:

You forgot a '=back' before '=head1'