diff options
Diffstat (limited to 'mod_log_sql.c')
-rw-r--r-- | mod_log_sql.c | 234 |
1 files changed, 158 insertions, 76 deletions
diff --git a/mod_log_sql.c b/mod_log_sql.c index 3b4e6f4..9309f9a 100644 --- a/mod_log_sql.c +++ b/mod_log_sql.c | |||
@@ -55,7 +55,9 @@ typedef struct { | |||
55 | int createtables; | 55 | int createtables; |
56 | int forcepreserve; | 56 | int forcepreserve; |
57 | char *machid; | 57 | char *machid; |
58 | int announce; | ||
58 | logsql_dbconnection db; | 59 | logsql_dbconnection db; |
60 | logsql_dbdriver *driver; | ||
59 | } global_config_t; | 61 | } global_config_t; |
60 | 62 | ||
61 | static global_config_t global_config; | 63 | static global_config_t global_config; |
@@ -99,7 +101,7 @@ typedef struct { | |||
99 | /* list of "handlers" for log types */ | 101 | /* list of "handlers" for log types */ |
100 | static apr_array_header_t *logsql_item_list; | 102 | static apr_array_header_t *logsql_item_list; |
101 | 103 | ||
102 | /* Registration Function for extract functions * | 104 | /* Registration function for extract functions * |
103 | * and update parse cache for transfer_log_format * | 105 | * and update parse cache for transfer_log_format * |
104 | * this is exported from the module */ | 106 | * this is exported from the module */ |
105 | LOGSQL_DECLARE(void) log_sql_register_item(server_rec *s, apr_pool_t *p, | 107 | LOGSQL_DECLARE(void) log_sql_register_item(server_rec *s, apr_pool_t *p, |
@@ -132,7 +134,14 @@ LOGSQL_DECLARE(void) log_sql_register_item(server_rec *s, apr_pool_t *p, | |||
132 | } | 134 | } |
133 | } | 135 | } |
134 | 136 | ||
135 | /* Include all the extract functions */ | 137 | /* Registration function for database drivers */ |
138 | LOGSQL_DECLARE(void) log_sql_register_driver(apr_pool_t *p, | ||
139 | logsql_dbdriver *driver) | ||
140 | { | ||
141 | global_config.driver = driver; | ||
142 | } | ||
143 | |||
144 | /* Include all the core extract functions */ | ||
136 | #include "functions.h" | 145 | #include "functions.h" |
137 | #if defined(WITH_APACHE13) | 146 | #if defined(WITH_APACHE13) |
138 | # include "functions13.h" | 147 | # include "functions13.h" |
@@ -156,7 +165,7 @@ static logsql_opendb_ret log_sql_opendb_link(server_rec* s) | |||
156 | passwd | 165 | passwd |
157 | */ | 166 | */ |
158 | if (global_config.db.parms) { | 167 | if (global_config.db.parms) { |
159 | result = log_sql_mysql_connect(s, &global_config.db); | 168 | result = global_config.driver->connect(s, &global_config.db); |
160 | if (result==LOGSQL_OPENDB_FAIL) { | 169 | if (result==LOGSQL_OPENDB_FAIL) { |
161 | global_config.db.connected = 0; | 170 | global_config.db.connected = 0; |
162 | } else { | 171 | } else { |
@@ -315,25 +324,23 @@ static const char *set_dbparam_slot(cmd_parms *cmd, | |||
315 | static const char *set_log_sql_info(cmd_parms *cmd, void *dummy, | 324 | static const char *set_log_sql_info(cmd_parms *cmd, void *dummy, |
316 | const char *host, const char *user, const char *pwd) | 325 | const char *host, const char *user, const char *pwd) |
317 | { | 326 | { |
318 | ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server, | ||
319 | "%s - %s - %s", host, user, pwd); | ||
320 | if (!user) { /* user is null, so only one arg passed */ | 327 | if (!user) { /* user is null, so only one arg passed */ |
321 | apr_uri_t uri; | 328 | apr_uri_t uri; |
322 | apr_uri_parse(cmd->pool, host, &uri); | 329 | apr_uri_parse(cmd->pool, host, &uri); |
323 | if (uri.scheme) { | 330 | if (uri.scheme) { |
324 | /* set DB plugin */ | 331 | set_dbparam(cmd, NULL, "driver", uri.scheme); |
325 | } | 332 | } |
326 | if (uri.hostname) { | 333 | if (uri.hostname) { |
327 | set_dbparam(cmd, NULL, "host", uri.hostname); | 334 | set_dbparam(cmd, NULL, "hostname", uri.hostname); |
328 | } | 335 | } |
329 | if (uri.user) { | 336 | if (uri.user) { |
330 | set_dbparam(cmd, NULL, "user", uri.user); | 337 | set_dbparam(cmd, NULL, "username", uri.user); |
331 | } | 338 | } |
332 | if (uri.password) { | 339 | if (uri.password) { |
333 | set_dbparam(cmd, NULL, "passwd", uri.password); | 340 | set_dbparam(cmd, NULL, "password", uri.password); |
334 | } | 341 | } |
335 | if (uri.port_str) { | 342 | if (uri.port_str) { |
336 | set_dbparam(cmd, NULL, "tcpport", uri.port_str); | 343 | set_dbparam(cmd, NULL, "port", uri.port_str); |
337 | } | 344 | } |
338 | if (uri.path) { | 345 | if (uri.path) { |
339 | /* extract Database name */ | 346 | /* extract Database name */ |
@@ -345,13 +352,13 @@ static const char *set_log_sql_info(cmd_parms *cmd, void *dummy, | |||
345 | } | 352 | } |
346 | } else { | 353 | } else { |
347 | if (*host != '.') { | 354 | if (*host != '.') { |
348 | set_dbparam(cmd, NULL, "host", host); | 355 | set_dbparam(cmd, NULL, "hostname", host); |
349 | } | 356 | } |
350 | if (*user != '.') { | 357 | if (*user != '.') { |
351 | set_dbparam(cmd, NULL, "user", user); | 358 | set_dbparam(cmd, NULL, "username", user); |
352 | } | 359 | } |
353 | if (*pwd != '.') { | 360 | if (*pwd != '.') { |
354 | set_dbparam(cmd, NULL, "passwd", pwd); | 361 | set_dbparam(cmd, NULL, "password", pwd); |
355 | } | 362 | } |
356 | } | 363 | } |
357 | return NULL; | 364 | return NULL; |
@@ -380,7 +387,7 @@ static const char *add_server_string_slot(cmd_parms *cmd, | |||
380 | #if defined(WITH_APACHE20) | 387 | #if defined(WITH_APACHE20) |
381 | static apr_status_t log_sql_close_link(void *data) | 388 | static apr_status_t log_sql_close_link(void *data) |
382 | { | 389 | { |
383 | log_sql_mysql_close(&global_config.db); | 390 | global_config.driver->disconnect(&global_config.db); |
384 | return APR_SUCCESS; | 391 | return APR_SUCCESS; |
385 | } | 392 | } |
386 | #elif defined(WITH_APACHE13) | 393 | #elif defined(WITH_APACHE13) |
@@ -454,6 +461,10 @@ static void log_sql_module_init(server_rec *s, apr_pool_t *p) | |||
454 | log_sql_register_item(s,p,'U', extract_request_uri, "request_uri", 1, 1); | 461 | log_sql_register_item(s,p,'U', extract_request_uri, "request_uri", 1, 1); |
455 | log_sql_register_item(s,p,'v', extract_virtual_host, "virtual_host", 0, 1); | 462 | log_sql_register_item(s,p,'v', extract_virtual_host, "virtual_host", 0, 1); |
456 | 463 | ||
464 | if (global_config.announce) { | ||
465 | ap_add_version_component(p, PACKAGE_NAME"/"PACKAGE_VERSION); | ||
466 | } | ||
467 | |||
457 | #if defined(WITH_APACHE20) | 468 | #if defined(WITH_APACHE20) |
458 | return OK; | 469 | return OK; |
459 | #endif | 470 | #endif |
@@ -478,7 +489,7 @@ static logsql_query_ret safe_sql_insert(request_rec *r, logsql_tabletype table_t | |||
478 | return LOGSQL_QUERY_NOLINK; | 489 | return LOGSQL_QUERY_NOLINK; |
479 | } | 490 | } |
480 | 491 | ||
481 | result = log_sql_mysql_query(r,&global_config.db,query); | 492 | result = global_config.driver->insert(r,&global_config.db,query); |
482 | 493 | ||
483 | /* If we ran the query and it returned an error, try to be robust. | 494 | /* If we ran the query and it returned an error, try to be robust. |
484 | * (After all, the module thought it had a valid mysql_log connection but the query | 495 | * (After all, the module thought it had a valid mysql_log connection but the query |
@@ -490,7 +501,7 @@ static logsql_query_ret safe_sql_insert(request_rec *r, logsql_tabletype table_t | |||
490 | return LOGSQL_QUERY_FAIL; | 501 | return LOGSQL_QUERY_FAIL; |
491 | /* TODO: What do we do here */ | 502 | /* TODO: What do we do here */ |
492 | case LOGSQL_QUERY_FAIL: | 503 | case LOGSQL_QUERY_FAIL: |
493 | log_sql_mysql_close(&global_config.db); | 504 | global_config.driver->disconnect(&global_config.db); |
494 | global_config.db.connected = 0; | 505 | global_config.db.connected = 0; |
495 | /* re-open the connection and try again */ | 506 | /* re-open the connection and try again */ |
496 | if (log_sql_opendb_link(r->server) != LOGSQL_OPENDB_FAIL) { | 507 | if (log_sql_opendb_link(r->server) != LOGSQL_OPENDB_FAIL) { |
@@ -509,7 +520,7 @@ static logsql_query_ret safe_sql_insert(request_rec *r, logsql_tabletype table_t | |||
509 | } | 520 | } |
510 | } | 521 | } |
511 | # endif | 522 | # endif |
512 | result = log_sql_mysql_query(r,&global_config.db,query); | 523 | result = global_config.driver->insert(r,&global_config.db,query); |
513 | if (result == LOGSQL_QUERY_SUCCESS) { | 524 | if (result == LOGSQL_QUERY_SUCCESS) { |
514 | return LOGSQL_QUERY_SUCCESS; | 525 | return LOGSQL_QUERY_SUCCESS; |
515 | } else { | 526 | } else { |
@@ -530,7 +541,7 @@ static logsql_query_ret safe_sql_insert(request_rec *r, logsql_tabletype table_t | |||
530 | if (global_config.createtables) { | 541 | if (global_config.createtables) { |
531 | log_error(APLOG_MARK,APLOG_ERR,0,r->server, | 542 | log_error(APLOG_MARK,APLOG_ERR,0,r->server, |
532 | "table doesn't exist...creating now"); | 543 | "table doesn't exist...creating now"); |
533 | if ((result = log_sql_mysql_create(r, &global_config.db, table_type, | 544 | if ((result = global_config.driver->create_table(r, &global_config.db, table_type, |
534 | table_name))!=LOGSQL_TABLE_SUCCESS) { | 545 | table_name))!=LOGSQL_TABLE_SUCCESS) { |
535 | log_error(APLOG_MARK,APLOG_ERR,result,r->server, | 546 | log_error(APLOG_MARK,APLOG_ERR,result,r->server, |
536 | "child attempted but failed to create one or more tables for %s, preserving query", ap_get_server_name(r)); | 547 | "child attempted but failed to create one or more tables for %s, preserving query", ap_get_server_name(r)); |
@@ -539,7 +550,7 @@ static logsql_query_ret safe_sql_insert(request_rec *r, logsql_tabletype table_t | |||
539 | } else { | 550 | } else { |
540 | log_error(APLOG_MARK,APLOG_ERR,result, r->server, | 551 | log_error(APLOG_MARK,APLOG_ERR,result, r->server, |
541 | "tables successfully created - retrying query"); | 552 | "tables successfully created - retrying query"); |
542 | if ((result = log_sql_mysql_query(r,&global_config.db,query))!=LOGSQL_QUERY_SUCCESS) { | 553 | if ((result = global_config.driver->insert(r,&global_config.db,query))!=LOGSQL_QUERY_SUCCESS) { |
543 | log_error(APLOG_MARK,APLOG_ERR,result, r->server, | 554 | log_error(APLOG_MARK,APLOG_ERR,result, r->server, |
544 | "giving up, preserving query"); | 555 | "giving up, preserving query"); |
545 | preserve_entry(r, query); | 556 | preserve_entry(r, query); |
@@ -600,20 +611,92 @@ static void *log_sql_make_state(apr_pool_t *p, server_rec *s) | |||
600 | return (void *) cls; | 611 | return (void *) cls; |
601 | } | 612 | } |
602 | 613 | ||
614 | |||
615 | /* Iterates through an array of char* and searches for a matching element | ||
616 | * Returns 0 if not found, 1 if found */ | ||
617 | static int in_array(apr_array_header_t *ary, const char *elem) | ||
618 | { | ||
619 | int itr; | ||
620 | for (itr = 0; itr < ary->nelts; itr++) { | ||
621 | if (!strcmp(elem,((char **)ary->elts)[itr])) { | ||
622 | return 1; | ||
623 | } | ||
624 | } | ||
625 | return 0; | ||
626 | } | ||
627 | |||
628 | /* Debugging print */ | ||
629 | #define PRINT_ARRAY(ary) { \ | ||
630 | char **a_ptr = (char **)(ary->elts); \ | ||
631 | int a_itr; \ | ||
632 | fprintf(stderr, "\nPrinting %s\n\n", #ary); \ | ||
633 | for (a_itr=0; a_itr<ary->nelts; a_itr++) { \ | ||
634 | fprintf(stderr, "Array Elem: %s\n",a_ptr[a_itr]); \ | ||
635 | } \ | ||
636 | } | ||
637 | |||
638 | /* Parse through cookie lists and merge based on +/- prefixes */ | ||
639 | #define DO_MERGE_ARRAY(parent,child,pool) \ | ||
640 | if (apr_is_empty_array(child)) { \ | ||
641 | apr_array_cat(child, parent); \ | ||
642 | } else { \ | ||
643 | apr_array_header_t *addlist, *dellist; \ | ||
644 | char **elem, **ptr = (char **)(child->elts); \ | ||
645 | int itr, overwrite = 0; \ | ||
646 | addlist = apr_array_make(pool,5,sizeof(char *)); \ | ||
647 | dellist = apr_array_make(subp,5,sizeof(char *)); \ | ||
648 | \ | ||
649 | for (itr=0; itr<child->nelts; itr++) { \ | ||
650 | if (*ptr[itr] == '+') { \ | ||
651 | elem = (char **)apr_array_push(addlist); \ | ||
652 | *elem = (ptr[itr]+1); \ | ||
653 | } else if (*ptr[itr] == '-') { \ | ||
654 | elem = (char **)apr_array_push(dellist); \ | ||
655 | *elem = (ptr[itr]+1); \ | ||
656 | } else { \ | ||
657 | overwrite = 1; \ | ||
658 | elem = (char **)apr_array_push(addlist); \ | ||
659 | *elem = ptr[itr]; \ | ||
660 | } \ | ||
661 | } \ | ||
662 | PRINT_ARRAY(addlist); \ | ||
663 | PRINT_ARRAY(dellist); \ | ||
664 | PRINT_ARRAY(parent); \ | ||
665 | child = apr_array_make(p,1,sizeof(char *)); \ | ||
666 | ptr = (char **)(parent->elts); \ | ||
667 | if (overwrite==0) { \ | ||
668 | /* if we are not overwriting the existing then prepare for merge */ \ | ||
669 | for (itr=0; itr<parent->nelts; itr++) { \ | ||
670 | if (!in_array(addlist, ptr[itr]) && !in_array(dellist,ptr[itr])) { \ | ||
671 | elem = apr_array_push(child); \ | ||
672 | *elem = apr_pstrdup(p, ptr[itr]); \ | ||
673 | } \ | ||
674 | } \ | ||
675 | } \ | ||
676 | PRINT_ARRAY(child); \ | ||
677 | apr_array_cat(child, addlist); \ | ||
678 | PRINT_ARRAY(child); \ | ||
679 | } | ||
680 | |||
603 | static void *log_sql_merge_state(apr_pool_t *p, void *basev, void *addv) | 681 | static void *log_sql_merge_state(apr_pool_t *p, void *basev, void *addv) |
604 | { | 682 | { |
605 | /* Fetch the two states to merge */ | 683 | /* Fetch the two states to merge */ |
606 | logsql_state *parent = (logsql_state *) basev; | 684 | logsql_state *parent = (logsql_state *) basev; |
607 | logsql_state *child = (logsql_state *) addv; | 685 | logsql_state *child = (logsql_state *) addv; |
608 | 686 | ||
687 | apr_pool_t *subp; | ||
688 | |||
689 | apr_pool_create(&subp,p); | ||
690 | |||
609 | /* Child can override these, otherwise they default to parent's choice. | 691 | /* Child can override these, otherwise they default to parent's choice. |
610 | * If the parent didn't set them, create reasonable defaults for the | 692 | * If the parent didn't set them, create reasonable defaults for the |
611 | * ones that should have such default settings. Leave the others null. */ | 693 | * ones that should have such default settings. Leave the others null. */ |
612 | 694 | ||
613 | child->transfer_table_name = child->transfer_table_name ? | ||
614 | child->transfer_table_name : parent->transfer_table_name; | ||
615 | /* No default for transfer_table_name because we want its absence | 695 | /* No default for transfer_table_name because we want its absence |
616 | * to disable logging. */ | 696 | * to disable logging. */ |
697 | if (!child->transfer_table_name) { | ||
698 | child->transfer_table_name = parent->transfer_table_name; | ||
699 | } | ||
617 | 700 | ||
618 | if (child->transfer_log_format == DEFAULT_TRANSFER_LOG_FMT) { | 701 | if (child->transfer_log_format == DEFAULT_TRANSFER_LOG_FMT) { |
619 | child->transfer_log_format = parent->transfer_log_format; | 702 | child->transfer_log_format = parent->transfer_log_format; |
@@ -637,30 +720,20 @@ static void *log_sql_merge_state(apr_pool_t *p, void *basev, void *addv) | |||
637 | if (child->cookie_table_name == DEFAULT_COOKIE_TABLE_NAME) | 720 | if (child->cookie_table_name == DEFAULT_COOKIE_TABLE_NAME) |
638 | child->cookie_table_name = parent->cookie_table_name; | 721 | child->cookie_table_name = parent->cookie_table_name; |
639 | 722 | ||
640 | if (apr_is_empty_array(child->transfer_ignore_list)) | 723 | DO_MERGE_ARRAY(parent->transfer_ignore_list, child->transfer_ignore_list, subp); |
641 | apr_array_cat(child->transfer_ignore_list, parent->transfer_ignore_list); | 724 | DO_MERGE_ARRAY(parent->transfer_accept_list, child->transfer_accept_list, subp); |
642 | 725 | DO_MERGE_ARRAY(parent->remhost_ignore_list, child->remhost_ignore_list, subp); | |
643 | if (apr_is_empty_array(child->transfer_accept_list)) | 726 | DO_MERGE_ARRAY(parent->notes_list, child->notes_list, subp); |
644 | apr_array_cat(child->transfer_accept_list, parent->transfer_accept_list); | 727 | DO_MERGE_ARRAY(parent->hin_list, child->hin_list, subp); |
645 | 728 | DO_MERGE_ARRAY(parent->hout_list, child->hout_list, subp); | |
646 | if (apr_is_empty_array(child->remhost_ignore_list)) | 729 | DO_MERGE_ARRAY(parent->cookie_list,child->cookie_list, subp); |
647 | apr_array_cat(child->remhost_ignore_list, parent->remhost_ignore_list); | ||
648 | |||
649 | if (apr_is_empty_array(child->notes_list)) | ||
650 | apr_array_cat(child->notes_list, parent->notes_list); | ||
651 | |||
652 | if (apr_is_empty_array(child->hin_list)) | ||
653 | apr_array_cat(child->hin_list, parent->hin_list); | ||
654 | 730 | ||
655 | if (apr_is_empty_array(child->hout_list)) | 731 | apr_pool_destroy(subp); |
656 | apr_array_cat(child->hout_list, parent->hout_list); | ||
657 | |||
658 | if (apr_is_empty_array(child->cookie_list)) | ||
659 | apr_array_cat(child->cookie_list, parent->cookie_list); | ||
660 | 732 | ||
661 | if (!child->cookie_name) | 733 | if (!child->cookie_name) |
662 | child->cookie_name = parent->cookie_name; | 734 | child->cookie_name = parent->cookie_name; |
663 | 735 | ||
736 | |||
664 | return (void*) child; | 737 | return (void*) child; |
665 | } | 738 | } |
666 | 739 | ||
@@ -804,7 +877,7 @@ static int log_sql_transaction(request_rec *orig) | |||
804 | item->sql_field_name, NULL); | 877 | item->sql_field_name, NULL); |
805 | values = apr_pstrcat(r->pool, values, (i ? "," : ""), | 878 | values = apr_pstrcat(r->pool, values, (i ? "," : ""), |
806 | (item->string_contents ? "'" : ""), | 879 | (item->string_contents ? "'" : ""), |
807 | log_sql_mysql_escape(formatted_item, r->pool,&global_config.db), | 880 | global_config.driver->escape(formatted_item, r->pool,&global_config.db), |
808 | (item->string_contents ? "'" : ""), NULL); | 881 | (item->string_contents ? "'" : ""), NULL); |
809 | } | 882 | } |
810 | 883 | ||
@@ -821,9 +894,9 @@ static int log_sql_transaction(request_rec *orig) | |||
821 | "('", | 894 | "('", |
822 | unique_id, | 895 | unique_id, |
823 | "','", | 896 | "','", |
824 | log_sql_mysql_escape(*ptrptr, r->pool,&global_config.db), | 897 | global_config.driver->escape(*ptrptr, r->pool,&global_config.db), |
825 | "','", | 898 | "','", |
826 | log_sql_mysql_escape(theitem, r->pool,&global_config.db), | 899 | global_config.driver->escape(theitem, r->pool,&global_config.db), |
827 | "')", | 900 | "')", |
828 | NULL); | 901 | NULL); |
829 | i++; | 902 | i++; |
@@ -849,9 +922,9 @@ static int log_sql_transaction(request_rec *orig) | |||
849 | "('", | 922 | "('", |
850 | unique_id, | 923 | unique_id, |
851 | "','", | 924 | "','", |
852 | log_sql_mysql_escape(*ptrptr, r->pool,&global_config.db), | 925 | global_config.driver->escape(*ptrptr, r->pool,&global_config.db), |
853 | "','", | 926 | "','", |
854 | log_sql_mysql_escape(theitem, r->pool,&global_config.db), | 927 | global_config.driver->escape(theitem, r->pool,&global_config.db), |
855 | "')", | 928 | "')", |
856 | NULL); | 929 | NULL); |
857 | i++; | 930 | i++; |
@@ -878,9 +951,9 @@ static int log_sql_transaction(request_rec *orig) | |||
878 | "('", | 951 | "('", |
879 | unique_id, | 952 | unique_id, |
880 | "','", | 953 | "','", |
881 | log_sql_mysql_escape(*ptrptr, r->pool,&global_config.db), | 954 | global_config.driver->escape(*ptrptr, r->pool,&global_config.db), |
882 | "','", | 955 | "','", |
883 | log_sql_mysql_escape(theitem, r->pool,&global_config.db), | 956 | global_config.driver->escape(theitem, r->pool,&global_config.db), |
884 | "')", | 957 | "')", |
885 | NULL); | 958 | NULL); |
886 | i++; | 959 | i++; |
@@ -907,9 +980,9 @@ static int log_sql_transaction(request_rec *orig) | |||
907 | "('", | 980 | "('", |
908 | unique_id, | 981 | unique_id, |
909 | "','", | 982 | "','", |
910 | log_sql_mysql_escape(*ptrptr, r->pool,&global_config.db), | 983 | global_config.driver->escape(*ptrptr, r->pool,&global_config.db), |
911 | "','", | 984 | "','", |
912 | log_sql_mysql_escape(theitem, r->pool,&global_config.db), | 985 | global_config.driver->escape(theitem, r->pool,&global_config.db), |
913 | "')", | 986 | "')", |
914 | NULL); | 987 | NULL); |
915 | i++; | 988 | i++; |
@@ -1005,7 +1078,34 @@ static int log_sql_transaction(request_rec *orig) | |||
1005 | * Structure: command, function called, NULL, where available, how many arguments, verbose description | 1078 | * Structure: command, function called, NULL, where available, how many arguments, verbose description |
1006 | */ | 1079 | */ |
1007 | static const command_rec log_sql_cmds[] = { | 1080 | static const command_rec log_sql_cmds[] = { |
1081 | AP_INIT_FLAG("LogSQLAnnounce", set_global_flag_slot, | ||
1082 | (void *)APR_OFFSETOF(global_config_t, announce), RSRC_CONF, | ||
1083 | "Whether to announce that mod_log_sql is loaded in the server header") | ||
1084 | , | ||
1085 | /* DB connection parameters */ | ||
1086 | AP_INIT_TAKE13("LogSQLLoginInfo", set_log_sql_info, NULL, RSRC_CONF, | ||
1087 | "The database connection URI in the form<br>driver://user:password@hostname:port/database") | ||
1088 | , | ||
1089 | AP_INIT_TAKE2("LogSQLDBParam", set_dbparam, NULL, RSRC_CONF, | ||
1090 | "First argument is the DB parameter, second is the value to assign") | ||
1091 | , | ||
1092 | AP_INIT_FLAG("LogSQLForcePreserve", set_global_flag_slot, | ||
1093 | (void *)APR_OFFSETOF(global_config_t, forcepreserve), RSRC_CONF, | ||
1094 | "Forces logging to preserve file and bypasses database") | ||
1095 | , | ||
1096 | AP_INIT_TAKE1("LogSQLPreserveFile", set_server_string_slot, | ||
1097 | (void *)APR_OFFSETOF(logsql_state,preserve_file), RSRC_CONF, | ||
1098 | "Name of the file to use for data preservation during database downtime") | ||
1099 | , | ||
1100 | AP_INIT_FLAG("LogSQLCreateTables", set_global_nmv_flag_slot, | ||
1101 | (void *)APR_OFFSETOF(global_config_t, createtables), RSRC_CONF, | ||
1102 | "Turn on module's capability to create its SQL tables on the fly") | ||
1103 | , | ||
1008 | /* Table names */ | 1104 | /* Table names */ |
1105 | AP_INIT_FLAG("LogSQLMassVirtualHosting", set_global_flag_slot, | ||
1106 | (void *)APR_OFFSETOF(global_config_t, massvirtual), RSRC_CONF, | ||
1107 | "Activates option(s) useful for ISPs performing mass virutal hosting") | ||
1108 | , | ||
1009 | AP_INIT_TAKE1("LogSQLTransferLogTable", set_server_nmv_string_slot, | 1109 | AP_INIT_TAKE1("LogSQLTransferLogTable", set_server_nmv_string_slot, |
1010 | (void *)APR_OFFSETOF(logsql_state, transfer_table_name), RSRC_CONF, | 1110 | (void *)APR_OFFSETOF(logsql_state, transfer_table_name), RSRC_CONF, |
1011 | "The database table that holds the transfer log") | 1111 | "The database table that holds the transfer log") |
@@ -1026,10 +1126,6 @@ static const command_rec log_sql_cmds[] = { | |||
1026 | (void *)APR_OFFSETOF(logsql_state, cookie_table_name), RSRC_CONF, | 1126 | (void *)APR_OFFSETOF(logsql_state, cookie_table_name), RSRC_CONF, |
1027 | "The database table that holds the cookie info") | 1127 | "The database table that holds the cookie info") |
1028 | , | 1128 | , |
1029 | AP_INIT_FLAG("LogSQLMassVirtualHosting", set_global_flag_slot, | ||
1030 | (void *)APR_OFFSETOF(global_config_t, massvirtual), RSRC_CONF, | ||
1031 | "Activates option(s) useful for ISPs performing mass virutal hosting") | ||
1032 | , | ||
1033 | /* Log format */ | 1129 | /* Log format */ |
1034 | AP_INIT_TAKE1("LogSQLTransferLogFormat", set_logformat_slot, | 1130 | AP_INIT_TAKE1("LogSQLTransferLogFormat", set_logformat_slot, |
1035 | NULL, RSRC_CONF, | 1131 | NULL, RSRC_CONF, |
@@ -1053,14 +1149,11 @@ static const command_rec log_sql_cmds[] = { | |||
1053 | (void *)APR_OFFSETOF(logsql_state, remhost_ignore_list), RSRC_CONF, | 1149 | (void *)APR_OFFSETOF(logsql_state, remhost_ignore_list), RSRC_CONF, |
1054 | "List of remote hosts to ignore. Accesses that match will not be logged to database") | 1150 | "List of remote hosts to ignore. Accesses that match will not be logged to database") |
1055 | , | 1151 | , |
1152 | /* Special loggin table configuration */ | ||
1056 | AP_INIT_TAKE1("LogSQLWhichCookie", set_server_string_slot, | 1153 | AP_INIT_TAKE1("LogSQLWhichCookie", set_server_string_slot, |
1057 | (void *)APR_OFFSETOF(logsql_state, cookie_name), RSRC_CONF, | 1154 | (void *)APR_OFFSETOF(logsql_state, cookie_name), RSRC_CONF, |
1058 | "The single cookie that you want logged in the access_log when using the 'c' config directive") | 1155 | "The single cookie that you want logged in the access_log when using the 'c' config directive") |
1059 | , | 1156 | , |
1060 | AP_INIT_TAKE1("LogSQLPreserveFile", set_server_string_slot, | ||
1061 | (void *)APR_OFFSETOF(logsql_state,preserve_file), RSRC_CONF, | ||
1062 | "Name of the file to use for data preservation during database downtime") | ||
1063 | , | ||
1064 | AP_INIT_ITERATE("LogSQLWhichNotes", add_server_string_slot, | 1157 | AP_INIT_ITERATE("LogSQLWhichNotes", add_server_string_slot, |
1065 | (void *)APR_OFFSETOF(logsql_state, notes_list), RSRC_CONF, | 1158 | (void *)APR_OFFSETOF(logsql_state, notes_list), RSRC_CONF, |
1066 | "Notes that you would like to log in a separate table") | 1159 | "Notes that you would like to log in a separate table") |
@@ -1077,36 +1170,25 @@ static const command_rec log_sql_cmds[] = { | |||
1077 | (void *)APR_OFFSETOF(logsql_state, cookie_list), RSRC_CONF, | 1170 | (void *)APR_OFFSETOF(logsql_state, cookie_list), RSRC_CONF, |
1078 | "The cookie(s) that you would like to log in a separate table") | 1171 | "The cookie(s) that you would like to log in a separate table") |
1079 | , | 1172 | , |
1080 | /* DB connection parameters */ | 1173 | AP_INIT_RAW_ARGS("LogSQLDeprecated", ap_set_deprecated, NULL, RSRC_CONF, |
1081 | AP_INIT_FLAG("LogSQLForcePreserve", set_global_flag_slot, | 1174 | "<br><b>Deprecated</b><br>The following Commands are deprecated and should not be used.. <br>Read the documentation for more information<br><b>Deprecated</b>") |
1082 | (void *)APR_OFFSETOF(global_config_t, forcepreserve), RSRC_CONF, | ||
1083 | "Forces logging to preserve file and bypasses database") | ||
1084 | , | ||
1085 | AP_INIT_FLAG("LogSQLCreateTables", set_global_nmv_flag_slot, | ||
1086 | (void *)APR_OFFSETOF(global_config_t, createtables), RSRC_CONF, | ||
1087 | "Turn on module's capability to create its SQL tables on the fly") | ||
1088 | , | ||
1089 | AP_INIT_TAKE13("LogSQLLoginInfo", set_log_sql_info, NULL, RSRC_CONF, | ||
1090 | "The database host, user-id and password for logging") | ||
1091 | , | ||
1092 | AP_INIT_TAKE2("LogSQLDBParam", set_dbparam, NULL, RSRC_CONF, | ||
1093 | "First argument is the DB parameter, second is the value to assign") | ||
1094 | , | 1175 | , |
1176 | /* Deprecated commands */ | ||
1095 | AP_INIT_TAKE1("LogSQLDatabase", set_dbparam_slot, | 1177 | AP_INIT_TAKE1("LogSQLDatabase", set_dbparam_slot, |
1096 | (void *)"database", RSRC_CONF, | 1178 | (void *)"database", RSRC_CONF, |
1097 | "The name of the database database for logging") | 1179 | "<b>(Deprecated) Use LogSQLDBParam database dbname.</b> The name of the database database for logging") |
1098 | , | 1180 | , |
1099 | AP_INIT_TAKE1("LogSQLTableType", set_dbparam_slot, | 1181 | AP_INIT_TAKE1("LogSQLTableType", set_dbparam_slot, |
1100 | (void *)"tabletype", RSRC_CONF, | 1182 | (void *)"tabletype", RSRC_CONF, |
1101 | "What kind of table to create (MyISAM, InnoDB,...) when creating tables") | 1183 | "<b>(Deprecated) Use LogSQLDBParam tabletype type.</b> What kind of table to create (MyISAM, InnoDB,...) when creating tables") |
1102 | , | 1184 | , |
1103 | AP_INIT_TAKE1("LogSQLSocketFile", set_dbparam_slot, | 1185 | AP_INIT_TAKE1("LogSQLSocketFile", set_dbparam_slot, |
1104 | (void *)"socketfile", RSRC_CONF, | 1186 | (void *)"socketfile", RSRC_CONF, |
1105 | "Name of the file to employ for socket connections to database") | 1187 | "<b>(Deprecated) Use LogSQLDBParam socketfile socket.</b> Name of the file to employ for socket connections to database") |
1106 | , | 1188 | , |
1107 | AP_INIT_TAKE1("LogSQLTCPPort", set_dbparam_slot, | 1189 | AP_INIT_TAKE1("LogSQLTCPPort", set_dbparam_slot, |
1108 | (void *)"tcpport", RSRC_CONF, | 1190 | (void *)"port", RSRC_CONF, |
1109 | "Port number to use for TCP connections to database, defaults to 3306 if not set") | 1191 | "<b>(Deprecated) Use LogSQLDBParam port port.</b> Port number to use for TCP connections to database, defaults to 3306 if not set") |
1110 | , | 1192 | , |
1111 | {NULL} | 1193 | {NULL} |
1112 | }; | 1194 | }; |