summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Edward Rudd 2004-09-20 02:51:50 +0000
committerGravatar Edward Rudd 2004-09-20 02:51:50 +0000
commit651cf26f1ceeb683e9a069017225b27c6d6360bd (patch)
tree6cd103ada0abcfd294797a9e683c41fc3a028605
parent104bb4c049e8a672af96977434bda814feee83b8 (diff)
auto table names for massVirtualhosting swap - with _
added 'V' logformat to log virtualhost according to canonical setting.
-rw-r--r--CHANGELOG7
-rw-r--r--Makefile.in6
-rw-r--r--TODO.in4
-rw-r--r--configure.ac4
-rw-r--r--functions.h7
-rw-r--r--mod_log_sql.c59
6 files changed, 53 insertions, 34 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 9bcc20a..ca767f8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,10 @@
11.100: 2004-09-?f
2* fixes for NULL fields (empty request_args)
3* fixed a mysql reconnect bug
4* wrong hostname was logged when using mass virtual hosting
5 Use, the new 'V' logformat
6* formatted massvirutalhosting tables to swap - with _.
7
11.99: 2004-07-28 81.99: 2004-07-28
2* Added DBI support (not completed yet) 9* Added DBI support (not completed yet)
3* fixed segfault in the mysql driver escape_string function 10* fixed segfault in the mysql driver escape_string function
diff --git a/Makefile.in b/Makefile.in
index a08ec1b..0a7b9be 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -73,13 +73,13 @@ PROVIDERS_SUBDIRS = @subdirs@
73srcdir = @abs_srcdir@ 73srcdir = @abs_srcdir@
74builddir = @abs_builddir@ 74builddir = @abs_builddir@
75 75
76OBJ = $(SOURCES:.c=.o) $(sslSOURCES:.c=.o) $(mysqlSOURCES:.c=.o) \ 76OBJ = $(coreSOURCES:.c=.o) $(sslSOURCES:.c=.o) $(mysqlSOURCES:.c=.o) \
77 $(dbiSOURCES:.c=.o) $(pgsqlSOURCES:.c=.o) 77 $(dbiSOURCES:.c=.o) $(pgsqlSOURCES:.c=.o)
78 78
79LO = $(SOURCES:.c=.lo) $(sslSOURCES:.c=.lo) $(mysqlSOURCES:.c=.lo) \ 79LO = $(coreSOURCES:.c=.lo) $(sslSOURCES:.c=.lo) $(mysqlSOURCES:.c=.lo) \
80 $(dbiSOURCES:.c=.lo) $(pgsqlSOURCES:.c=.lo) 80 $(dbiSOURCES:.c=.lo) $(pgsqlSOURCES:.c=.lo)
81 81
82SLO = $(SOURCES:.c=.slo) $(sslSOURCES:.c=.slo) $(mysqlSOURCES:.c=.slo) \ 82SLO = $(coreSOURCES:.c=.slo) $(sslSOURCES:.c=.slo) $(mysqlSOURCES:.c=.slo) \
83 $(dbiSOURCES:.c=.slo) $(pgsqlSOURCES:.c=.slo) 83 $(dbiSOURCES:.c=.slo) $(pgsqlSOURCES:.c=.slo)
84 84
85STD_DIST = install-sh \ 85STD_DIST = install-sh \
diff --git a/TODO.in b/TODO.in
index 12bb30c..2686a44 100644
--- a/TODO.in
+++ b/TODO.in
@@ -1,4 +1,6 @@
1TODO: 1TODO:
2* verify a db driver has been loaded.
3* validate table names before trying to log them.
2* write alternate DB driver (PostgreSQL, libDBI, mod_*_pool) 4* write alternate DB driver (PostgreSQL, libDBI, mod_*_pool)
3* look at forcing table name to ServerName instead of on of the names in 5* look at forcing table name to ServerName instead of on of the names in
4 ServerAlias? 6 ServerAlias?
@@ -9,7 +11,7 @@ TODO:
9* investigate thread safety issues 11* investigate thread safety issues
10 Use libmysqlclient_r for threaded MPM (or always?) 12 Use libmysqlclient_r for threaded MPM (or always?)
11 Add thread locks if using standard mysqlclient 13 Add thread locks if using standard mysqlclient
12 Check locking issues with the preserve file? 14 Check locking issues with the preserve file
13* rewrite main core logging function to optimize for speed. 15* rewrite main core logging function to optimize for speed.
14* Clean up table creation code. 16* Clean up table creation code.
15 support DB independent way of defining the tables 17 support DB independent way of defining the tables
diff --git a/configure.ac b/configure.ac
index 322cde2..7dd9489 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@ CHECK_MYSQL(
26 AC_MSG_WARN([*** Mysql client libraries not found!]) 26 AC_MSG_WARN([*** Mysql client libraries not found!])
27 WANT_MYSQL_MOD=0 27 WANT_MYSQL_MOD=0
28 ) 28 )
29
29AC_SUBST(WANT_MYSQL_MOD) 30AC_SUBST(WANT_MYSQL_MOD)
30 31
31CHECK_LIBDBI(WANT_DBI_MOD=1, 32CHECK_LIBDBI(WANT_DBI_MOD=1,
@@ -41,9 +42,10 @@ AC_SUBST(WANT_PGSQL_MOD)
41 42
42CHECK_MOD_SSL( 43CHECK_MOD_SSL(
43 WANT_SSL_MOD=1, 44 WANT_SSL_MOD=1,
44 AC_MSG_ERROR([** mod_ssl.h not found or missing SSL headers!]) 45 AC_MSG_WARN([** mod_ssl.h not found or missing SSL headers!])
45 WANT_SSL_MOD=0 46 WANT_SSL_MOD=0
46 ) 47 )
48
47AC_SUBST(WANT_SSL_MOD) 49AC_SUBST(WANT_SSL_MOD)
48 50
49case "$target" in 51case "$target" in
diff --git a/functions.h b/functions.h
index dcbc939..b35634a 100644
--- a/functions.h
+++ b/functions.h
@@ -99,7 +99,12 @@ static const char *extract_status(request_rec *r, char *a)
99 99
100static const char *extract_virtual_host(request_rec *r, char *a) 100static const char *extract_virtual_host(request_rec *r, char *a)
101{ 101{
102 return apr_pstrdup(r->pool, r->server->server_hostname); 102 return r->server->server_hostname;
103}
104
105static const char *extract_server_name(request_rec *r, char *a)
106{
107 return ap_get_server_name(r);
103} 108}
104 109
105static const char *extract_machine_id(request_rec *r, char *a) 110static const char *extract_machine_id(request_rec *r, char *a)
diff --git a/mod_log_sql.c b/mod_log_sql.c
index 7aaa595..13a7eb8 100644
--- a/mod_log_sql.c
+++ b/mod_log_sql.c
@@ -464,35 +464,36 @@ static int log_sql_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptem
464static void log_sql_module_init(server_rec *s, apr_pool_t *p) 464static void log_sql_module_init(server_rec *s, apr_pool_t *p)
465#endif 465#endif
466{ 466{
467 /* TODO: Add local_address, remote_address, server_name, connection_status */ 467 /* TODO: Add local_address, remote_address, server_name, connection_status */
468 /* Register handlers */ 468 /* Register handlers */
469 log_sql_register_item(s,p,'A', extract_agent, "agent", 1, 1); 469 log_sql_register_item(s,p,'A', extract_agent, "agent", 1, 1);
470 log_sql_register_item(s,p,'a', extract_request_query, "request_args", 1, 1); 470 log_sql_register_item(s,p,'a', extract_request_query, "request_args", 1, 1);
471 log_sql_register_item(s,p,'b', extract_bytes_sent, "bytes_sent", 0, 0); 471 log_sql_register_item(s,p,'b', extract_bytes_sent, "bytes_sent", 0, 0);
472 log_sql_register_item(s,p,'c', extract_cookie, "cookie", 0, 1); 472 log_sql_register_item(s,p,'c', extract_cookie, "cookie", 0, 1);
473 /* TODO: Document */ 473 /* TODO: Document */
474 log_sql_register_item(s,p,'f', extract_request_file, "request_file", 0, 1); 474 log_sql_register_item(s,p,'f', extract_request_file, "request_file", 0, 1);
475 log_sql_register_item(s,p,'H', extract_request_protocol, "request_protocol", 0, 1); 475 log_sql_register_item(s,p,'H', extract_request_protocol, "request_protocol", 0, 1);
476 log_sql_register_item(s,p,'h', extract_remote_host, "remote_host", 0, 1); 476 log_sql_register_item(s,p,'h', extract_remote_host, "remote_host", 0, 1);
477 log_sql_register_item(s,p,'I', extract_unique_id, "id", 0, 1); 477 log_sql_register_item(s,p,'I', extract_unique_id, "id", 0, 1);
478 log_sql_register_item(s,p,'l', extract_remote_logname, "remote_logname", 0, 1); 478 log_sql_register_item(s,p,'l', extract_remote_logname, "remote_logname", 0, 1);
479 log_sql_register_item(s,p,'m', extract_request_method, "request_method", 0, 1); 479 log_sql_register_item(s,p,'m', extract_request_method, "request_method", 0, 1);
480 log_sql_register_item(s,p,'M', extract_machine_id, "machine_id", 0, 1); 480 log_sql_register_item(s,p,'M', extract_machine_id, "machine_id", 0, 1);
481 log_sql_register_item(s,p,'P', extract_child_pid, "child_pid", 0, 0); 481 log_sql_register_item(s,p,'P', extract_child_pid, "child_pid", 0, 0);
482 log_sql_register_item(s,p,'p', extract_server_port, "server_port", 0, 0); 482 log_sql_register_item(s,p,'p', extract_server_port, "server_port", 0, 0);
483 log_sql_register_item(s,p,'R', extract_referer, "referer", 1, 1); 483 log_sql_register_item(s,p,'R', extract_referer, "referer", 1, 1);
484 log_sql_register_item(s,p,'r', extract_request_line, "request_line", 1, 1); 484 log_sql_register_item(s,p,'r', extract_request_line, "request_line", 1, 1);
485 log_sql_register_item(s,p,'S', extract_request_timestamp, "time_stamp", 0, 0); 485 log_sql_register_item(s,p,'S', extract_request_timestamp, "time_stamp", 0, 0);
486 log_sql_register_item(s,p,'s', extract_status, "status", 1, 0); 486 log_sql_register_item(s,p,'s', extract_status, "status", 1, 0);
487 log_sql_register_item(s,p,'T', extract_request_duration, "request_duration", 1, 0); 487 log_sql_register_item(s,p,'T', extract_request_duration, "request_duration", 1, 0);
488 log_sql_register_item(s,p,'t', extract_request_time, "request_time", 0, 1); 488 log_sql_register_item(s,p,'t', extract_request_time, "request_time", 0, 1);
489 log_sql_register_item(s,p,'u', extract_remote_user, "remote_user", 0, 1); 489 log_sql_register_item(s,p,'u', extract_remote_user, "remote_user", 0, 1);
490 log_sql_register_item(s,p,'U', extract_request_uri, "request_uri", 1, 1); 490 log_sql_register_item(s,p,'U', extract_request_uri, "request_uri", 1, 1);
491 log_sql_register_item(s,p,'v', extract_virtual_host, "virtual_host", 0, 1); 491 log_sql_register_item(s,p,'v', extract_virtual_host, "virtual_host", 0, 1);
492 492 log_sql_register_item(s,p,'V', extract_server_name, "virtual_host", 0, 1);
493 if (global_config.announce) { 493
494 ap_add_version_component(p, PACKAGE_NAME"/"PACKAGE_VERSION); 494 if (global_config.announce) {
495 } 495 ap_add_version_component(p, PACKAGE_NAME"/"PACKAGE_VERSION);
496 }
496 /* ap_server_root_relative any default preserve file locations */ 497 /* ap_server_root_relative any default preserve file locations */
497 { 498 {
498 server_rec *cur_s; 499 server_rec *cur_s;
@@ -798,12 +799,14 @@ static int log_sql_transaction(request_rec *orig)
798 char *cookie_base = "cookies_"; 799 char *cookie_base = "cookies_";
799 800
800 801
801 /* Determint the hostname and convert it to all lower-case; */ 802 /* Determine the hostname and convert it to all lower-case; */
802 char *servername = apr_pstrdup(orig->pool,(char *)ap_get_server_name(orig)); 803 char *servername = apr_pstrdup(orig->pool,(char *)ap_get_server_name(orig));
804
803 char *p=servername; 805 char *p=servername;
804 while (*p) { 806 while (*p) {
805 *p = apr_tolower(*p); 807 *p = apr_tolower(*p);
806 if (*p == '.') *p = '_'; 808 if (*p == '.') *p = '_';
809 if (*p == '-') *p = '_';
807 ++p; 810 ++p;
808 } 811 }
809 812