debian/0000755000000000000000000000000012167175535007202 5ustar debian/601mod_log_sql_dbi.info0000644000000000000000000000022211723216731013406 0ustar LoadModule: log_sql_dbi_module /usr/lib/apache/1.3/mod_log_sql_dbi.so Description: Logging to SQL database insted of plain files. - DBI interface debian/mysql_import_combined_log.xml0000644000000000000000000000374111723216731015160 0ustar mysql_import_combined_log.pl -d <database name> -t <table name> [-h <host name>] [-u <user name>] [-p <password>] [-f <filename>]

Aaron Jenson

Updated to work under Perl 5.6.1 by Edward Rudd

Michael A. Toth <lirul.lists@gmail.com> - based on content of script

This man page was written using by the same author.

debian/libapache2-mod-log-sql-dbi.postinst0000755000000000000000000000034511735773075015676 0ustar #!/bin/sh set -e case "$1" in configure) a2enmod log_sql_dbi || : ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/compat0000644000000000000000000000000211723225152010364 0ustar 9 debian/log_sql_mysql.load0000644000000000000000000000011611723216731012715 0ustar LoadModule log_sql_mysql_module /usr/lib/apache2/modules/mod_log_sql_mysql.so debian/libapache2-mod-log-sql-mysql.install0000644000000000000000000000015212167172672016055 0ustar .libs/mod_log_sql_mysql.so usr/lib/apache2/modules/ debian/log_sql_mysql.load etc/apache2/mods-available/ debian/libapache2-mod-log-sql-mysql.prerm0000755000000000000000000000033011735773104015532 0ustar #!/bin/sh set -e case "$1" in remove|upgrade|deconfigure) a2dismod log_sql_mysql || : ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/libapache2-mod-log-sql.install0000644000000000000000000000013612167172672014714 0ustar .libs/mod_log_sql.so usr/lib/apache2/modules/ debian/log_sql.load etc/apache2/mods-available/ debian/libapache2-mod-log-sql-ssl.links0000644000000000000000000000011611723216731015153 0ustar usr/share/doc/libapache2-mod-log-sql usr/share/doc/libapache2-mod-log-sql-ssl debian/control0000644000000000000000000000435312167173102010576 0ustar Source: libapache-mod-log-sql Section: libs Priority: optional Maintainer: Thomas Goirand Build-Depends: apache2-dev (>= 2.4), autotools-dev, debhelper (>= 9), libdbi-dev, libmysqlclient15-dev | libmysqlclient12-dev | libmysqlclient-dev, libssl-dev Standards-Version: 3.9.4 Homepage: http://www.outoforder.cc/projects/apache/mod_log_sql/ Package: libapache2-mod-log-sql Architecture: any Depends: apache2-mpm-prefork (>= 2.0.53) | apache2-mpm-itk, ${misc:Depends}, ${shlibs:Depends} Recommends: perl Description: Use SQL to store/write your Apache queries logs - Base mod_log_sql is a log module for Apache 1.3 and 2 which logs all requests to a database. . Base package. . If you want to use make_combined_log and mysql_import_combined_log scripts you will need installed perl package. . Created for Apache 2. Use libapache-mod-log-sql for Apache 1.3. Package: libapache2-mod-log-sql-mysql Architecture: any Depends: libapache2-mod-log-sql (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Recommends: libapache2-mod-log-sql-ssl Description: Use SQL to store/write your Apache queries logs - MySQL interface mod_log_sql is a log module for Apache 1.3 and 2.0 which logs all requests to a MySQL database. . MySQL interface. . Created for Apache 2. Use libapache-mod-log-sql-mysql for Apache 1.3. Package: libapache2-mod-log-sql-dbi Architecture: any Depends: libapache2-mod-log-sql (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Recommends: libapache2-mod-log-sql-ssl Description: Use SQL to store/write your Apache queries logs - DBI interface mod_log_sql is a log module for Apache 1.3 and 2 which logs all requests to a MySQL database. . DBI interface. . Created for Apache 2. Use libapache-mod-log-sql-dbi for Apache 1.3. Package: libapache2-mod-log-sql-ssl Architecture: any Depends: libapache2-mod-log-sql (= ${binary:Version}), libapache2-mod-log-sql-mysql (= ${binary:Version}) | libapache2-mod-log-sql-dbi (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Description: Use SQL to store/write your Apache queries logs - SSL extension mod_log_sql is a log module for Apache 1.3 and 2 which logs all requests to a database. . For logging SSL connection information (cipher, hash, etc.). debian/libapache2-mod-log-sql.postinst0000755000000000000000000000044311735773113015132 0ustar #!/bin/sh set -e case "$1" in configure) a2enmod log_sql || : ;; abort-upgrade|abort-remove|abort-deconfigure) echo "Called with abort-upgrade|abort-remove|abort-deconfigure" ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/libapache2-mod-log-sql-ssl.prerm0000755000000000000000000000032611735773140015173 0ustar #!/bin/sh set -e case "$1" in remove|upgrade|deconfigure) a2dismod log_sql_ssl || : ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/601mod_log_sql_mysql.info0000644000000000000000000000023011723216731014014 0ustar LoadModule: log_sql_mysql_module /usr/lib/apache/1.3/mod_log_sql_mysql.so Description: Logging to SQL database insted of plain files. - MySQL interface debian/log_sql_dbi.load0000644000000000000000000000011211723216731012302 0ustar LoadModule log_sql_dbi_module /usr/lib/apache2/modules/mod_log_sql_dbi.so debian/log_sql_ssl.load0000644000000000000000000000011211723216731012345 0ustar LoadModule log_sql_ssl_module /usr/lib/apache2/modules/mod_log_sql_ssl.so debian/mysql_import_combined_log2.10000644000000000000000000000227211723216731014600 0ustar .TH mysql_import_combined_log.pl 1 User Manuals .SH NAME mysql_import_combined_log.pl \- Imports an Apache combined log into a MySQL database. .SH SYNOPSIS \fBmysql_import_combined_log.pl \fI\-d \f1\fB \fI\-t \f1\fB \fI[\-h ]\f1\fB \fI[\-u ]\f1\fB \fI[\-p ]\f1\fB \fI[\-f ]\f1\fB \fB .SH OPTIONS .TP \fB\-\-host|\-h \f1 The host to connect to. Default is localhost. .TP \fB\-\-database|\-d \f1 The database to use. Required. .TP \fB\-\-username|\-u \f1 The user to connect as. .TP \fB\-\-password|\-p \f1 The user's password. .TP \fB\-\-table|\-t
\f1 The name of the table in which to insert data. .TP \fB\-\-logfile|\-f \f1 The file to read from. If not given, data is read from stdin. .TP \fB\-\-help|\-?\f1 Print out this help message. .TP \fB\-\-version\f1 Print out the version of this software. .SH AUTHOR Aaron Jenson Updated to work under Perl 5.6.1 by Edward Rudd .SH MAN PAGE CREATED BY Michael A. Toth \- based on content of script .SH COMMENTS This man page was written using \fBxml2man (1)\f1 by the same author. debian/libapache2-mod-log-sql-mysql.links0000644000000000000000000000012011723216731015512 0ustar usr/share/doc/libapache2-mod-log-sql usr/share/doc/libapache2-mod-log-sql-mysql debian/source/0000755000000000000000000000000011723225154010470 5ustar debian/source/format0000644000000000000000000000001411723225154011676 0ustar 3.0 (quilt) debian/libapache2-mod-log-sql-mysql.postinst0000755000000000000000000000034711735773047016306 0ustar #!/bin/sh set -e case "$1" in configure) a2enmod log_sql_mysql || : ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/libapache2-mod-log-sql.prerm0000755000000000000000000000032211735773121014367 0ustar #!/bin/sh set -e case "$1" in remove|upgrade|deconfigure) a2dismod log_sql || : ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/libapache2-mod-log-sql.docs0000644000000000000000000000006011723216731014162 0ustar TODO docs/manual.html contrib/create_tables.sql debian/libapache2-mod-log-sql-dbi.links0000644000000000000000000000011611723216731015110 0ustar usr/share/doc/libapache2-mod-log-sql usr/share/doc/libapache2-mod-log-sql-dbi debian/600mod_log_sql.info0000644000000000000000000000130411723216731012571 0ustar LoadModule: log_sql_module /usr/lib/apache/1.3/mod_log_sql.so Directives: LogSQLAnnounce LogSQLCookieLogTable LogSQLCreateTables LogSQLDatabase LogSQLDBParam LogSQLDeprecated LogSQLDisablePreserve LogSQLForcePreserve LogSQLHeadersInLogTable LogSQLHeadersOutLogTable LogSQLLoginInfo LogSQLMachineID LogSQLMassVirtualHosting LogSQLNotesLogTable LogSQLPreserveFile LogSQLRemhostIgnore LogSQLRequestAccept LogSQLRequestIgnore LogSQLSocketFile LogSQLTableType LogSQLTCPPort LogSQLTransferLogFormat LogSQLTransferLogTable LogSQLWhichCookie LogSQLWhichCookies LogSQLWhichHeadersIn LogSQLWhichHeadersOut LogSQLWhichNotes Description: Logging to SQL database insted of plain files. - Base debian/make_combined_log.1.xml0000644000000000000000000000363311723216731013475 0ustar make_combined_log.pl <days> <virtual host>

This perl script extracts the httpd access data from a MySQL database and formats it properly for parsing by 3rd-party log analysis tools.

The script is intended to be run out by cron. Its commandline arguments tell it how many days' worth of access records to extract, and which virtual_host you are interested in (because many people log several virthosts to one MySQL db.) This permits you to run it daily, weekly, every 9 days -- whatever you decide.

By "days" I mean "chunks of 24 hours prior to the moment this script is run." So if you run it at 4:34 p.m. on the 12th, it will go back through 4:34 p.m. on the 11th.

Because GET and POST are not discriminated in the MySQL log, we'll just assume that all requests are GETs. This should have negligible effect on any analysis software. This could be remedied IF you stored the full HTTP request in your database instead of just the URI, but that's going to cost you a LOT of space really quickly...

Because this is somewhat of a quick hack it doesn't do the most robust error checking in the world. Run it by hand to confirm your usage before putting it in crontab.

Edward Rudd <eddie@omegaware.com>

Michael A. Toth <lirul.lists@gmail.com> - based on comments of script

This man page was written using by the same author.

debian/make_combined_log2.10000644000000000000000000000307411723216731012757 0ustar .TH make_combined_log.pl 1 User Manuals .SH NAME make_combined_log.pl \- make combined logfile from SQL database .SH SYNOPSIS \fBmake_combined_log.pl \fI\f1\fB \fI\f1\fB \fB .SH DESCRIPTION This perl script extracts the httpd access data from a MySQL database and formats it properly for parsing by 3rd\-party log analysis tools. The script is intended to be run out by cron. Its commandline arguments tell it how many days' worth of access records to extract, and which virtual_host you are interested in (because many people log several virthosts to one MySQL db.) This permits you to run it daily, weekly, every 9 days \-\- whatever you decide. .SH NOTE By "days" I mean "chunks of 24 hours prior to the moment this script is run." So if you run it at 4:34 p.m. on the 12th, it will go back through 4:34 p.m. on the 11th. .SH KNOWN ISSUES Because GET and POST are not discriminated in the MySQL log, we'll just assume that all requests are GETs. This should have negligible effect on any analysis software. This could be remedied IF you stored the full HTTP request in your database instead of just the URI, but that's going to cost you a LOT of space really quickly... Because this is somewhat of a quick hack it doesn't do the most robust error checking in the world. Run it by hand to confirm your usage before putting it in crontab. .SH AUTHOR Edward Rudd .SH MAN PAGE CREATED BY Michael A. Toth \- based on comments of script .SH COMMENTS This man page was written using \fBxml2man (1)\f1 by the same author. debian/libapache2-mod-log-sql-ssl.dirs0000644000000000000000000000006311723216731014775 0ustar usr/lib/apache2/modules etc/apache2/mods-available debian/libapache2-mod-log-sql-mysql.dirs0000644000000000000000000000006311723216731015341 0ustar usr/lib/apache2/modules etc/apache2/mods-available debian/libapache2-mod-log-sql.dirs0000644000000000000000000000007311723216731014177 0ustar usr/bin usr/lib/apache2/modules etc/apache2/mods-available debian/patches/0000755000000000000000000000000012167173601010621 5ustar debian/patches/002-mod_log_sql.h.patch0000644000000000000000000000174511723225000014661 0ustar From: Thomas Goirand Subject: Add a scoreboard feature to mod_log_sql You can keep tracks of number of hits and bytes for each of the hosted websites. --- libapache-mod-log-sql/mod_log_sql.h.orig 2007-08-06 00:03:47.000000000 +0800 +++ libapache-mod-log-sql/mod_log_sql.h 2007-08-06 00:52:49.000000000 +0800 @@ -67,7 +67,8 @@ LOGSQL_TABLE_NOTES, LOGSQL_TABLE_HEADERSOUT, LOGSQL_TABLE_HEADERSIN, - LOGSQL_TABLE_COOKIES + LOGSQL_TABLE_COOKIES, + LOGSQL_TABLE_SCORE } logsql_tabletype; /* All Tables */ @@ -96,6 +97,8 @@ /* create a SQL table named table_name of table_type */ logsql_table_ret (*create_table)(request_rec *r, logsql_dbconnection *db, logsql_tabletype table_type, const char *table_name); + /* enclose an insert query with parameters to make it an insert ignore */ + const char * (*enclose_insert_ignore)(const char* insert_query,request_rec *r); } logsql_dbdriver; LOGSQL_DECLARE(void) log_sql_register_driver(apr_pool_t *p, debian/patches/series0000644000000000000000000000034612167173315012043 0ustar 001-mod_log_sql.c.patch 002-mod_log_sql.h.patch 003-mod_log_sql_dbi.c.patch 004-mod_log_sql_mysql.c.patch 005-mod_log_sql_pgsql.c.patch 006-Makefile.in.patch 008-create_tables.sql_adds-doc.patch compatibility-with-apache2.4.patch debian/patches/006-Makefile.in.patch0000644000000000000000000000106011723224665014270 0ustar From: Thomas Goirand Subject: Make it compile for debian --- mod_log_sql-1.100/Makefile.in 2005-01-12 06:00:10.000000000 +0800 +++ libapache-mod-log-sql-cvs/Makefile.in 2006-08-26 13:27:08.000000000 +0800 @@ -176,8 +176,8 @@ $(RM) -r .libs distclean: clean distclean-subdirs - $(RM) config.status config.log config.h config.h.in \ - configure stamp-h stamp-h.in Makefile aclocal.m4 + $(RM) config.status config.log config.h \ + Makefile config.nice stamp-h $(RM) -r autom4te-2.53.cache DESTDIR = @PACKAGE_NAME@-@PACKAGE_VERSION@ debian/patches/008-create_tables.sql_adds-doc.patch0000644000000000000000000000240211723224677017305 0ustar From: Thomas Goirand Subject: Documents the score_board table format --- mod_log_sql-1.100/contrib/create_tables.sql 2005-01-11 22:00:11.000000000 +0000 +++ ../libapache-mod-log-sql-1.100/contrib/create_tables.sql 2008-09-24 08:21:59.000000000 +0000 @@ -49,3 +49,24 @@ item varchar(80), val varchar(80) ); + +# Added by Thomas Goirand (Debian maintainer and score_board patch upstream) +# take care that the UNIQUE KEY is really VITAL of you don't want your server +# to die with a huge MySQL load... +create table score_board ( + id int(14) NOT NULL auto_increment, + vhost varchar(50) NOT NULL default '', + bytes_sent bigint(14) unsigned NOT NULL default '0', + bytes_receive bigint(14) unsigned 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 '', + PRIMARY KEY (id), + UNIQUE KEY `vhost` (`vhost`,`month`,`year`,`domain`) +) TYPE=MyISAM; debian/patches/003-mod_log_sql_dbi.c.patch0000644000000000000000000000166511723225024015502 0ustar From: Thomas Goirand Subject: Add a scoreboard feature to mod_log_sql You can keep tracks of number of hits and bytes for each of the hosted websites. --- libapache-mod-log-sql/mod_log_sql_dbi.c.orig 2007-08-06 00:55:18.000000000 +0800 +++ libapache-mod-log-sql/mod_log_sql_dbi.c 2007-08-06 00:53:04.000000000 +0800 @@ -219,6 +219,10 @@ return LOGSQL_TABLE_SUCCESS; } +static char *make_dbi_ignore_insert(char * insert_query, request_rec *r) { + return apr_psprintf(r->pool, "insert ignore into %s ;",insert_query); +} + static logsql_dbdriver log_sql_dbi_driver = { "dbi", NULL, @@ -226,7 +230,8 @@ log_sql_dbi_close, /* close DB connection */ log_sql_dbi_escape, /* escape query */ log_sql_dbi_query, /* insert query */ - log_sql_dbi_create /* create table */ + log_sql_dbi_create, /* create table */ + make_dbi_ignore_insert /* insert ignore */ }; static apr_status_t log_sql_dbi_cleanup(void *data) debian/patches/001-mod_log_sql.c.patch0000644000000000000000000001247311723224750014666 0ustar From: Thomas Goirand Subject: Add a scoreboard feature to mod_log_sql You can keep tracks of number of hits and bytes for each of the hosted websites. --- libapache-mod-log-sql/mod_log_sql.c.orig 2007-08-06 00:03:47.000000000 +0800 +++ libapache-mod-log-sql/mod_log_sql.c 2007-08-06 00:52:46.000000000 +0800 @@ -37,6 +37,11 @@ #define DEFAULT_HOUT_TABLE_NAME "headers_out" #define DEFAULT_COOKIE_TABLE_NAME "cookies" #define DEFAULT_PRESERVE_FILE "logs/mod_log_sql-preserve" +#define DEFAULT_SCOREBOARD_DOMAIN "www" +#define DEFAULT_SCOREBOARD_SUBDOMAIN "default-domain.tld" +#define DEFAULT_SCOREBOARD_TABLE_NAME "scoreboard" + +#include /* -------------* * DECLARATIONS * @@ -96,6 +101,9 @@ logsql_item **parsed_log_format; const char *preserve_file; const char *cookie_name; + const char *scoreboard_domain; + const char *scoreboard_subdomain; + const char *scoreboard_table_name; } logsql_state; @@ -450,6 +458,10 @@ } } +static char* log_sql_insert_enclose(char* insert_close,request_rec *r) { + return global_config.driver->enclose_insert_ignore(insert_close,r); +} + /* post_config / module_init */ #if defined(WITH_APACHE20) static int log_sql_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) @@ -638,6 +650,9 @@ cls->hout_table_name = DEFAULT_HOUT_TABLE_NAME; cls->cookie_table_name = DEFAULT_COOKIE_TABLE_NAME; cls->preserve_file = DEFAULT_PRESERVE_FILE; + cls->scoreboard_domain = DEFAULT_SCOREBOARD_DOMAIN; + cls->scoreboard_subdomain = DEFAULT_SCOREBOARD_SUBDOMAIN; + cls->scoreboard_table_name = DEFAULT_SCOREBOARD_TABLE_NAME; cls->transfer_ignore_list = apr_array_make(p, 1, sizeof(char *)); cls->transfer_accept_list = apr_array_make(p, 1, sizeof(char *)); @@ -748,6 +763,15 @@ if (child->cookie_table_name == DEFAULT_COOKIE_TABLE_NAME) child->cookie_table_name = parent->cookie_table_name; + if (child->scoreboard_domain == DEFAULT_SCOREBOARD_DOMAIN) + child->scoreboard_domain = parent->scoreboard_domain; + + if (child->scoreboard_subdomain == DEFAULT_SCOREBOARD_SUBDOMAIN) + child->scoreboard_subdomain = parent->scoreboard_subdomain; + + if (child->scoreboard_table_name == DEFAULT_SCOREBOARD_TABLE_NAME) + child->scoreboard_table_name = parent->scoreboard_table_name; + DO_MERGE_ARRAY(parent->transfer_ignore_list, child->transfer_ignore_list, subp); DO_MERGE_ARRAY(parent->transfer_accept_list, child->transfer_accept_list, subp); DO_MERGE_ARRAY(parent->remhost_ignore_list, child->remhost_ignore_list, subp); @@ -779,6 +803,10 @@ const char *hout_tablename = cls->hout_table_name; const char *hin_tablename = cls->hin_table_name; const char *cookie_tablename = cls->cookie_table_name; + const char *scoreboard_domain = cls->scoreboard_domain; + const char *scoreboard_subdomain = cls->scoreboard_subdomain; + const char *scoreboard_table_name = cls->scoreboard_table_name; + struct timeval now_time; /* We handle mass virtual hosting differently. Dynamically determine the name * of the table from the virtual server's name, and flag it for creation. @@ -1097,6 +1125,39 @@ if (cookie_query) safe_sql_insert(orig, LOGSQL_TABLE_COOKIES,cookie_tablename,cookie_query); + gettimeofday(&now_time, (struct timeval*)0); + + { + const char *score_query_insert; + const char *score_query_update; + const char *score_query_insert_ignore; + struct tm *ptr; + time_t tm; + char sql_month[60]; + char sql_year[60]; + char a[60]; + char* bytes_sent; + + tm = time(NULL); + ptr = localtime(&tm); + strftime(sql_month ,100 , "\%m",ptr); + strftime(sql_year ,100 , "\%Y",ptr); + + score_query_insert = apr_psprintf(r->pool, " %s (domain,vhost,month,year,count_impressions) values ('%s','%s','%s','%s','0')" + ,scoreboard_table_name,scoreboard_domain,scoreboard_subdomain,sql_month,sql_year); + // Add insert ignore into ... ; + // or begin; insert into ... ; commit; + // depending on the drive used + score_query_insert_ignore = log_sql_insert_enclose(score_query_insert,r); + + safe_sql_insert(orig,LOGSQL_TABLE_SCORE,"score_board",score_query_insert_ignore); + bytes_sent = extract_bytes_sent(r, a); + if (bytes_sent[0] != '-'){ + score_query_update = apr_psprintf(r->pool, "update %s SET count_impressions = count_impressions+1, bytes_sent = bytes_sent+%s WHERE domain='%s' AND vhost='%s' AND month='%s' AND year='%s'" + ,scoreboard_table_name,extract_bytes_sent(r, a),scoreboard_domain,scoreboard_subdomain,sql_month,sql_year); + safe_sql_insert(orig,LOGSQL_TABLE_SCORE,"score_board",score_query_update); + } + } return OK; } } @@ -1158,6 +1219,18 @@ (void *)APR_OFFSETOF(logsql_state, cookie_table_name), RSRC_CONF, "The database table that holds the cookie info") , + AP_INIT_TAKE1("LogSQLScoreDomain", set_server_nmv_string_slot, + (void *)APR_OFFSETOF(logsql_state, scoreboard_domain), RSRC_CONF, + "The domain to set in scoreboard") + , + AP_INIT_TAKE1("LogSQLScoreSubdomain", set_server_nmv_string_slot, + (void *)APR_OFFSETOF(logsql_state, scoreboard_subdomain), RSRC_CONF, + "The subdomain to set in scoreboard") + , + AP_INIT_TAKE1("LogSQLScoreTable", set_server_nmv_string_slot, + (void *)APR_OFFSETOF(logsql_state, scoreboard_table_name), RSRC_CONF, + "The scoreboard to log in") + , /* Log format */ AP_INIT_TAKE1("LogSQLTransferLogFormat", set_logformat_slot, NULL, RSRC_CONF, debian/patches/005-mod_log_sql_pgsql.c.patch0000644000000000000000000000175711723225101016072 0ustar From: Thomas Goirand Subject: Add a scoreboard feature to mod_log_sql You can keep tracks of number of hits and bytes for each of the hosted websites. --- libapache-mod-log-sql/mod_log_sql_pgsql.c.orig 2007-08-06 00:55:44.000000000 +0800 +++ libapache-mod-log-sql/mod_log_sql_pgsql.c 2007-08-06 00:52:55.000000000 +0800 @@ -235,6 +235,10 @@ return LOGSQL_TABLE_SUCCESS; } +static char *make_pgsql_ignore_insert(char * insert_query, request_rec *r) { + return apr_psprintf(r->pool, "begin ; insert into %s ; commit ;",insert_query); +} + static char *supported_drivers[] = {"pgsql",NULL}; static logsql_dbdriver pgsql_driver = { supported_drivers, @@ -242,7 +246,8 @@ log_sql_pgsql_close, /* close DB connection */ log_sql_pgsql_escape, /* escape query */ log_sql_pgsql_query, /* insert query */ - log_sql_pgsql_create /* create table */ + log_sql_pgsql_create, /* create table */ + make_pgsql_ignore_insert /* insert ignore statement */ }; LOGSQL_REGISTER(pgsql) { debian/patches/compatibility-with-apache2.4.patch0000644000000000000000000000117112167173601017127 0ustar Description: Fixes compatibility with Apache 2.4 API Author: Thomas Goirand Bug-Debian: http://bugs.debian.org/666797 Forwarded: http://lists.outoforder.cc/pipermail/mod_log_sql/2012-April/000358.html Last-Update: 2013-07-10 --- libapache-mod-log-sql-1.100.orig/functions.h +++ libapache-mod-log-sql-1.100/functions.h @@ -14,7 +14,7 @@ static const char *extract_remote_addres static const char *extract_remote_address(request_rec *r, char *a) { - return r->connection->remote_ip; + return r->useragent_ip; } static const char *extract_local_address(request_rec *r, char *a) __attribute__((unused)); debian/patches/007-mod_log_sql.c_funny-table-names.patch0000644000000000000000000000453411723225134020275 0ustar From: Thomas Goirand Subject: Add the possibility to use any kind of names for the table names by escaping it when calling SQL. --- libapache-mod-log-sql-1.100/mod_log_sql.c.orig 2008-04-23 04:58:51.000000000 +0000 +++ libapache-mod-log-sql-1.100/mod_log_sql.c 2008-04-23 04:58:53.000000000 +0000 @@ -931,7 +931,7 @@ } } if ( itemsets != "" ) { - note_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s", + note_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val) values %s", /*global_config.insertdelayed?"delayed":*/"", notes_tablename, itemsets); log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: note string: %s", note_query); @@ -959,7 +959,7 @@ } } if ( itemsets != "" ) { - hout_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s", + hout_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val) values %s", /*global_config.insertdelayed?"delayed":*/"", hout_tablename, itemsets); log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: header_out string: %s", hout_query); @@ -988,7 +988,7 @@ } } if ( itemsets != "" ) { - hin_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s", + hin_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val) values %s", /*global_config.insertdelayed?"delayed":*/"", hin_tablename, itemsets); log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: header_in string: %s", hin_query); @@ -1018,7 +1018,7 @@ } if ( itemsets != "" ) { - cookie_query = apr_psprintf(r->pool, "insert %s into %s (id, item, val) values %s", + cookie_query = apr_psprintf(r->pool, "insert %s into `%s` (id, item, val) values %s", /*global_config.insertdelayed?"delayed":*/"", cookie_tablename, itemsets); log_error(APLOG_MARK,APLOG_DEBUG,0, orig->server,"mod_log_sql: cookie string: %s", cookie_query); @@ -1026,7 +1026,7 @@ /* Set up the actual INSERT statement */ - access_query = apr_psprintf(r->pool, "insert %s into %s (%s) values (%s)", + access_query = apr_psprintf(r->pool, "insert %s into `%s` (%s) values (%s)", /*global_config.insertdelayed?"delayed":*/"", transfer_tablename, fields, values); log_error(APLOG_MARK,APLOG_DEBUG,0, r->server,"mod_log_sql: access string: %s", access_query); debian/patches/004-mod_log_sql_mysql.c.patch0000644000000000000000000000173211723225045016110 0ustar From: Thomas Goirand Subject: Add a scoreboard feature to mod_log_sql You can keep tracks of number of hits and bytes for each of the hosted websites. --- libapache-mod-log-sql/mod_log_sql_mysql.c.orig 2007-08-06 00:55:32.000000000 +0800 +++ libapache-mod-log-sql/mod_log_sql_mysql.c 2007-08-06 00:52:59.000000000 +0800 @@ -250,6 +250,10 @@ return LOGSQL_TABLE_SUCCESS; } +static char *make_mysql_ignore_insert(char * insert_query, request_rec *r) { + return apr_psprintf(r->pool, "insert ignore into %s ;",insert_query); +} + static const char *supported_drivers[] = {"mysql",NULL}; static logsql_dbdriver mysql_driver = { "mysql", @@ -258,7 +262,8 @@ log_sql_mysql_close, /* close DB connection */ log_sql_mysql_escape, /* escape query */ log_sql_mysql_query, /* insert query */ - log_sql_mysql_create /* create table */ + log_sql_mysql_create, /* create table */ + make_mysql_ignore_insert /* insert ignore */ }; LOGSQL_REGISTER(mysql) { debian/libapache2-mod-log-sql-ssl.install0000644000000000000000000000014612167172672015514 0ustar .libs/mod_log_sql_ssl.so usr/lib/apache2/modules/ debian/log_sql_ssl.load etc/apache2/mods-available/ debian/libapache2-mod-log-sql-dbi.dirs0000644000000000000000000000006311723216731014732 0ustar usr/lib/apache2/modules etc/apache2/mods-available debian/watch0000644000000000000000000000012411723216731010217 0ustar version=3 http://www.outoforder.cc/downloads/mod_log_sql/mod_log_sql-(.*)\.tar\.bz2 debian/libapache2-mod-log-sql.manpages0000644000000000000000000000010011723216731015020 0ustar debian/make_combined_log2.1 debian/mysql_import_combined_log2.1 debian/libapache2-mod-log-sql-dbi.install0000644000000000000000000000014612167172672015451 0ustar .libs/mod_log_sql_dbi.so usr/lib/apache2/modules/ debian/log_sql_dbi.load etc/apache2/mods-available/ debian/changelog0000644000000000000000000001263112167175535011057 0ustar libapache-mod-log-sql (1.100-15) unstable; urgency=low * Rebuilt for apache 2.4 (Closes: #666797): - Build-depends on apache2-dev and not the prefork version. - Adds patch for the 2.4 API. * Ran warp-and-sort. * debian/copyright in parsable format 1.0. * Standard-Version is now 3.9.4. -- Thomas Goirand Wed, 10 Jul 2013 05:47:46 +0000 libapache-mod-log-sql (1.100-14.2) unstable; urgency=low * Non-maintainer upload. * Remove deprecated dpatch and upgrade to packaging format "3.0 quilt". * Update to Standards-Version to 3.9.3 and debhelper to 9. * Add ${misc:Depends} and correct spelling of "Apache" in control file. * Add build-arch and build-indep targets; use dh_prep in rules file. * Correct Lintian command-with-path-in-maintainer-script by using standards ":" shell operator instead of /bin/true in *.{post*,pre*}. -- Jari Aalto Sun, 01 Apr 2012 09:33:46 +0300 libapache-mod-log-sql (1.100-14.1) unstable; urgency=low * Non-maintainer upload. * Pick up the pieces of the libdbi transition: change the libdbi0-dev build-dependency to libdbi-dev. (Closes: #635660) * Drop the obsolete conflicts against libdbi0. -- Philipp Kern Thu, 28 Jul 2011 09:46:28 +0200 libapache-mod-log-sql (1.100-14) unstable; urgency=low * Added doc about how to create the score_board table (Closes: #499436). * Updated dependencies to apache2-mpm-prefork | apache2-mpm-itk, so both can be setup (Closes: #494306). As of today, mod_log_sql still doesn't support apache with threads. -- Thomas Goirand Wed, 24 Sep 2008 07:44:30 +0000 libapache-mod-log-sql (1.100-13) unstable; urgency=low * Reverted the "patch for funny table names" as it's only working for MySQL and it's preventing other backends from working. -- Thomas Goirand Tue, 01 Jul 2008 13:16:36 +0000 libapache-mod-log-sql (1.100-12) unstable; urgency=low * The extended description contained "Created for apache-2.0." This is now updated to Apache 2 (Closes: #471546). * This version now includes a patch for funny table names, so that they are escaped using the ` character in the MySQL queries. This corrects the bug sent in the Ubuntu's launchpad. * Now the debian/rules clean target also removes: Makefile config.h config.nice contrib/Makefile docs/Makefile stamp-h (as they are made by the ./configure). This removes some lintian warnings. -- Thomas Goirand Wed, 23 Apr 2008 09:23:24 +0000 libapache-mod-log-sql (1.100-11.1) unstable; urgency=low * NMU * -11 was supposed to be uploaded in order to make a new version of the package, using the new ABI of libdbi-0.8.2. Changed the build dependency to reflect this: libdbi0-dev (>= 0.8.2) -- Kari Pahula Sat, 24 Nov 2007 23:30:45 +0200 libapache-mod-log-sql (1.100-11) unstable; urgency=low * Because of a change of at least type in libdbi, added an entry in the control file: Conflicts: libdbi0 (< 0.8.2) -- Thomas Goirand Sun, 25 Nov 2007 03:19:16 +0800 libapache-mod-log-sql (1.100-10) unstable; urgency=low * This is release -10 because we have -9 in our GPLHost private repository, please forgive me, if version -9 was never release into Debian, but I really don't want to messup with our production servers. * Changed to the new style of dependency (= ${binary:Version}) instead of (= ${Source:Version}) * Remove the build for apache 1.3 and it's depends (Closes: #429090) * Changed the score board patch from "INSERT INGORE INTO" to a better "BEGIN ; INSERT INTO [...] ; COMMIT" if using pgsql, so the score board patch can work under pgsql too, thanks to James Cloos for the idea. Note that this included some bigger modifications to the modules so the statements can differ depending on the driver used. (Closes: #425027) -- Thomas Goirand Fri, 20 Jul 2007 16:24:15 +0800 libapache-mod-log-sql (1.100-8) unstable; urgency=low * There is now a check if apache returns - (dash) as the number of bytes sent, so it doesn't fill up your error.log with MySQL error messages when no bytes are sent. -- Thomas Goirand Wed, 28 Feb 2007 10:00:18 +0000 libapache-mod-log-sql (1.100-7) unstable; urgency=low * Remove the use of debconf. (Closes: #402809) * and thus no template correction (Closes: #402657) -- Thomas Goirand Sat, 17 Dec 2006 17:06:10 +0800 libapache-mod-log-sql (1.100-6) unstable; urgency=low * libapache-mod-log-sql uses debconf like libapache2-mod-log-sql to warn about where is the dump example * Fix: debconf files added (was missing and breaking install). * Fix: libapache-mod-log-sql files (man pages) don't conflict with libapache2-mod-log-sql anymore * Fix: the .pl scripts for libapache-mod-log-sql are now installed without the extension and not twice as before. -- Thomas Goirand Mon, 13 Nov 2006 17:06:10 +0800 libapache-mod-log-sql (1.100-5) unstable; urgency=low * Added libapache2-mod-log-sql to the build. -- Thomas Goirand Wed, 8 Nov 2006 13:06:10 +0800 libapache-mod-log-sql (1.100-4) unstable; urgency=low * Initial Release. * Uploading with revision -4 to not break current installations. -- Thomas Goirand Mon, 6 Nov 2006 13:06:10 +0800 debian/log_sql.load0000644000000000000000000000010211723216731011463 0ustar LoadModule log_sql_module /usr/lib/apache2/modules/mod_log_sql.so debian/libapache2-mod-log-sql-dbi.prerm0000755000000000000000000000032611735773026015133 0ustar #!/bin/sh set -e case "$1" in remove|upgrade|deconfigure) a2dismod log_sql_dbi || : ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/copyright0000644000000000000000000001261612167175466011146 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: mod-log-sql Upstream-Contact: General mod_log_sql discussion Source: http://www.outoforder.cc/projects/apache/mod_log_sql/ Files: debian/* Copyright: (c) 2005, Michael A. Toth (c) 2006-2013, Thomas Goirand License: mod-log-sql Files: * Copyright: (c) 2004-2012 Edward M. Rudd. All rights reserved. (c) 2002 Christopher B. Powell. All rights reserved. (c) 2000 The Apache Software Foundation. License: mod-log-sql License: mod-log-sql Preamble . The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. . Definitions: . * "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. . * "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. . * "Copyright Holder" is Christopher B. Powell, . . * "You" is you, if you're thinking about copying or distributing this Package. . * "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) . * "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. . 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. . 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: . a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. . b) use the modified Package only within your corporation or organization. . c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. . d) make other distribution arrangements with the Copyright Holder. . 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: . a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. . b) accompany the distribution with the machine-readable source of the Package with your modifications. . c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. . d) make other distribution arrangements with the Copyright Holder. . 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. . 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. . 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. . 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. . 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. . The End debian/libapache2-mod-log-sql-ssl.postinst0000755000000000000000000000034511735773130015731 0ustar #!/bin/sh set -e case "$1" in configure) a2enmod log_sql_ssl || : ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac #DEBHELPER# exit 0 debian/rules0000755000000000000000000000416611735772422010267 0ustar #!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) CFLAGS = -Wall -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif # Configure for libapache-mod-log-sql # Note: no libapache-mod-log-sql-ssl currently because mod_ssl.h # is not provided anywhere in the Debian distro (a bug repport has been filled) configure-libapache2-mod-log-sql-stamp: dh_testdir CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info \ --with-apxs=/usr/bin/apxs2 \ --with-mysql=/usr \ --with-ssl-inc=/usr/include/apache2 touch $@ build-libapache2-mod-log-sql-stamp: configure-libapache2-mod-log-sql-stamp dh_testdir $(MAKE) touch $@ build-arch: build build-indep: build build: build-stamp build-stamp: build-libapache2-mod-log-sql-stamp touch $@ clean: dh_testdir dh_testroot rm -f build-stamp liba2-stamp [ ! -f Makefile ] || $(MAKE) clean rm -f *.so rm -f config.cache config.status config.log rm -f Makefile config.h config.nice contrib/Makefile docs/Makefile stamp-h dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs -A install -m 0755 contrib/make_combined_log.pl debian/libapache2-mod-log-sql/usr/bin/make_combined_log2 install -m 0755 contrib/mysql_import_combined_log.pl debian/libapache2-mod-log-sql/usr/bin/mysql_import_combined_log2 binary-indep: build install binary-arch: build install dh_testdir dh_testroot dh_installchangelogs CHANGELOG dh_install dh_installdocs dh_installman dh_installdebconf dh_strip dh_compress dh_fixperms dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install