diff --git a/CHANGES b/CHANGES index 9765bb2a2a..83d7da77fa 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ DD MMM YYYY - 2.9.2 - To be released ------------------------------------ + * {dis|en}able-collection-delete-problem-logging: Option to disable logging of + collection delete problem in audit log when log level < 9. + [Issue #576 - Marc Stern] * {dis|en}able-filename-logging: Option to disable logging of filename in audit log. [Issue #1065 - Marc Stern] diff --git a/apache2/persist_dbm.c b/apache2/persist_dbm.c index 76c3820baf..7f8b6f104c 100644 --- a/apache2/persist_dbm.c +++ b/apache2/persist_dbm.c @@ -217,10 +217,13 @@ static apr_table_t *collection_retrieve_ex(apr_sdbm_t *existing_dbm, modsec_rec rc = apr_sdbm_delete(dbm, key); if (rc != APR_SUCCESS) { - msr_log(msr, 1, "collection_retrieve_ex: Failed deleting collection (name \"%s\", " +#ifdef LOG_NO_COLL_DELET_PB + if (msr->txcfg->debuglog_level >= 9) +#endif + msr_log(msr, 1, "collection_retrieve_ex: Failed deleting collection (name \"%s\", " "key \"%s\"): %s", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, col_key, col_key_len), get_apr_error(msr->mp, rc)); - msr->msc_sdbm_delete_error = 1; + msr->msc_sdbm_delete_error = 1; goto cleanup; } @@ -678,10 +681,13 @@ int collections_remove_stale(modsec_rec *msr, const char *col_name) { if (expiry_time <= now) { rc = apr_sdbm_delete(dbm, key); if (rc != APR_SUCCESS) { - msr_log(msr, 1, "collections_remove_stale: Failed deleting collection (name \"%s\", " +#ifdef LOG_NO_COLL_DELET_PB + if (msr->txcfg->debuglog_level >= 9) +#endif + msr_log(msr, 1, "collections_remove_stale: Failed deleting collection (name \"%s\", " "key \"%s\"): %s", log_escape(msr->mp, col_name), log_escape_ex(msr->mp, key.dptr, key.dsize - 1), get_apr_error(msr->mp, rc)); - msr->msc_sdbm_delete_error = 1; + msr->msc_sdbm_delete_error = 1; goto error; } diff --git a/configure.ac b/configure.ac index e7e5098afd..f65363f43d 100644 --- a/configure.ac +++ b/configure.ac @@ -442,6 +442,21 @@ AC_ARG_ENABLE(filename-logging, log_filename='' ]) +# Disable logging of problem when deleting collection +AC_ARG_ENABLE(collection-delete-problem-logging, + AS_HELP_STRING([--enable-collection-delete-problem-logging], + [Enable logging of collection delete problem in audit log when log level < 9. This is the default]), +[ + if test "$enableval" != "no"; then + log_collection_delete_problem= + else + log_collection_delete_problem="-DLOG_NO_COLL_DELET_PB" + fi +], +[ + log_collection_delete_problem='' +]) + # Ignore configure errors AC_ARG_ENABLE(errors, AS_HELP_STRING([--disable-errors], @@ -692,7 +707,7 @@ else fi fi -MODSEC_EXTRA_CFLAGS="$pcre_study $pcre_match_limit $pcre_match_limit_recursion $pcre_jit $request_early $htaccess_config $lua_cache $debug_conf $debug_cache $debug_acmp $debug_mem $perf_meas $modsec_api $cpu_type $unique_id $log_filename" +MODSEC_EXTRA_CFLAGS="$pcre_study $pcre_match_limit $pcre_match_limit_recursion $pcre_jit $request_early $htaccess_config $lua_cache $debug_conf $debug_cache $debug_acmp $debug_mem $perf_meas $modsec_api $cpu_type $unique_id $log_filename $log_collection_delete_problem" APXS_WRAPPER=build/apxs-wrapper APXS_EXTRA_CFLAGS=""