[Mod_log_sql] scoreboard table and debian package

Thomas Goirand thomas at goirand.fr
Wed Nov 2 17:50:38 EST 2005


Hi there !

I'm a Debian user, and I love mod_log_sql. So I did 2 Debian source 
package. It's very easy to integrate it in the mail mod_log_sql archive, 
you simply need to have what's attached to this mail in a folder called 
"debian", and then everybody will be able to make the Debian package 
using "dpkg-buildpackage". There is NOT EVEN ONE modification to the 
original mod_log_sql2 source code to use this.

There is 2 archives, one is for apache 1.3, one for apache2. I'm not 
sure if it's possible to have them coexist in the same Debian folder. 
Any help on that topic would be appreciated. Maybe it's possible to see 
what kind of apache-dev package is installed when building.

The mod_log_sql.c file attached to this message, is a modified version 
of mod_log_sql 1.100 that has a scoreboard table. This table holds the 
total hits and bytes_sent for all vhost of apache. Here's how to create 
the table itself :


CREATE TABLE IF NOT EXISTS `scoreboard` (
  `id` int(14) NOT NULL auto_increment,
  `vhost` varchar(50) NOT NULL default '',
  `bytes_sent` int(14) NOT NULL default '0',
  `count_hosts` int(12) NOT NULL default '0',
  `count_visits` int(12) NOT NULL default '0',
  `count_status_200` int(12) NOT NULL default '0',
  `count_status_404` int(12) NOT NULL default '0',
  `count_impressions` int(18) NOT NULL default '0',
  `last_run` int(14) NOT NULL default '0',
  `month` int(4) NOT NULL default '0',
  `year` int(4) NOT NULL default '0',
  `domain` varchar(50) NOT NULL default '',
  `bytes_receive` int(14) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `vhost` (`vhost`,`month`,`year`,`domain`)
) TYPE=MyISAM;

Please note that you currently have to create the table BEFORE you 
launch apache with mod_log_sql.

Also, the following directives are now added :

LogSQLScoreDomain -> this is what will be targeted when doing the UPDATE 
query, default is default-domain.tld
LogSQLScoreSubdomain -> this is what will be targeted when doing the 
UPDATE query, default is www
LogSQLScoreTable -> this is the score table used for doing the stats

Please be warn also that the UNIQUE KEY is very important, as my code do 
a INSERT IGNORE and a UPDATE for each apache requests (so I don't have 
to check with a SELECT to see if there is already a record).

I'll make it optional : if none of the Score directives is present, then 
totally disable the scores for the given vhost. Moreover, I need that a 
given http usage is accounted on an admin of my control panel (dtc), so 
I'll patch even more to have that feature.

I have to tell that I'm very happy of the result, and I hope everybody 
will like my patch. Please tell your point about it.

Regards,

    Thomas Goirand, GPLHost LLC Manager
-- 
mailto:thomas at gplhost.com
callto://+1.(302)-213-1611
http://www.gplhost.com
GPLHost:>_ Opensource hosting worldwide
Webspaces featuring GPL control panel
Locations in Florida and Singapore


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mod_log_sql.c
Url: http://lists.outoforder.cc/pipermail/mod_log_sql/attachments/20051102/990f0a8c/attachment.c 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libapache-mod-log-sql2_1.100_debian_folder.tar.gz
Type: application/octet-stream
Size: 2601 bytes
Desc: not available
Url : http://lists.outoforder.cc/pipermail/mod_log_sql/attachments/20051102/990f0a8c/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libapache2-mod-log-sql2_1.100_debian_folder.tar.gz
Type: application/octet-stream
Size: 2549 bytes
Desc: not available
Url : http://lists.outoforder.cc/pipermail/mod_log_sql/attachments/20051102/990f0a8c/attachment-0001.obj 


More information about the Mod_log_sql mailing list