Skip to content

Commit d243818

Browse files
Marc SternFelipe Zimmerle
Marc Stern
authored and
Felipe Zimmerle
committed
{dis|en}able-collection-delete-problem-logging: Option to disable logging of collection delete problem in audit log when log level < 9 in audit log [Issue #576 - Marc Stern]
1 parent 53a8bb2 commit d243818

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

CHANGES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
DD MMM YYYY - 2.9.2 - To be released
22
------------------------------------
33

4+
* {dis|en}able-collection-delete-problem-logging: Option to disable logging of
5+
collection delete problem in audit log when log level < 9.
6+
[Issue #576 - Marc Stern]
47
* Adds rule id in logs whenever a rule fail.
58
[Issue #1379, #391 - Marc Stern]
69
* {dis|en}able-server-logging: Option to disable logging of

apache2/persist_dbm.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,13 @@ static apr_table_t *collection_retrieve_ex(apr_sdbm_t *existing_dbm, modsec_rec
217217

218218
rc = apr_sdbm_delete(dbm, key);
219219
if (rc != APR_SUCCESS) {
220-
msr_log(msr, 1, "collection_retrieve_ex: Failed deleting collection (name \"%s\", "
220+
#ifdef LOG_NO_COLL_DELET_PB
221+
if (msr->txcfg->debuglog_level >= 9)
222+
#endif
223+
msr_log(msr, 1, "collection_retrieve_ex: Failed deleting collection (name \"%s\", "
221224
"key \"%s\"): %s", log_escape(msr->mp, col_name),
222225
log_escape_ex(msr->mp, col_key, col_key_len), get_apr_error(msr->mp, rc));
223-
msr->msc_sdbm_delete_error = 1;
226+
msr->msc_sdbm_delete_error = 1;
224227
goto cleanup;
225228
}
226229

@@ -678,10 +681,13 @@ int collections_remove_stale(modsec_rec *msr, const char *col_name) {
678681
if (expiry_time <= now) {
679682
rc = apr_sdbm_delete(dbm, key);
680683
if (rc != APR_SUCCESS) {
681-
msr_log(msr, 1, "collections_remove_stale: Failed deleting collection (name \"%s\", "
684+
#ifdef LOG_NO_COLL_DELET_PB
685+
if (msr->txcfg->debuglog_level >= 9)
686+
#endif
687+
msr_log(msr, 1, "collections_remove_stale: Failed deleting collection (name \"%s\", "
682688
"key \"%s\"): %s", log_escape(msr->mp, col_name),
683689
log_escape_ex(msr->mp, key.dptr, key.dsize - 1), get_apr_error(msr->mp, rc));
684-
msr->msc_sdbm_delete_error = 1;
690+
msr->msc_sdbm_delete_error = 1;
685691
goto error;
686692
}
687693

configure.ac

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,21 @@ AC_ARG_ENABLE(server-logging,
457457
log_server=''
458458
])
459459

460+
# Disable logging of problem when deleting collection
461+
AC_ARG_ENABLE(collection-delete-problem-logging,
462+
AS_HELP_STRING([--enable-collection-delete-problem-logging],
463+
[Enable logging of collection delete problem in audit log when log level < 9. This is the default]),
464+
[
465+
if test "$enableval" != "no"; then
466+
log_collection_delete_problem=
467+
else
468+
log_collection_delete_problem="-DLOG_NO_COLL_DELET_PB"
469+
fi
470+
],
471+
[
472+
log_collection_delete_problem=''
473+
])
474+
460475
# Ignore configure errors
461476
AC_ARG_ENABLE(errors,
462477
AS_HELP_STRING([--disable-errors],
@@ -707,7 +722,7 @@ else
707722
fi
708723
fi
709724

710-
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_server"
725+
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_server $log_collection_delete_problem"
711726

712727
APXS_WRAPPER=build/apxs-wrapper
713728
APXS_EXTRA_CFLAGS=""

0 commit comments

Comments
 (0)