Skip to content

Option to disable logging of log producer in audit log #1382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
DD MMM YYYY - 2.9.2 - To be released
------------------------------------

* {dis|en}able-log-producer-logging: Option to disable logging of
log producer in audit log when log level < 9.
[Issue #1069 - Marc Stern]
* {dis|en}able-filename-logging: Option to disable logging of filename
in audit log.
[Issue #1065 - Marc Stern]
Expand Down
6 changes: 6 additions & 0 deletions apache2/msc_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ static void sec_auditlog_write_producer_header(modsec_rec *msr) {
char *text = NULL;
int i;

#ifdef LOG_NO_PRODUCER
if (msr->txcfg->debuglog_level < 9) return;
#endif
/* Try to write everything in one go. */
if (msr->txcfg->component_signatures->nelts == 0) {
text = apr_psprintf(msr->mp, "Producer: %s.\n", MODSEC_MODULE_NAME_FULL);
Expand Down Expand Up @@ -1171,6 +1174,9 @@ void sec_audit_logger_json(modsec_rec *msr) {
yajl_kv_bool(g, "response_body_dechunked", 1);
}

#ifdef LOG_NO_PRODUCER
if (msr->txcfg->debuglog_level < 9) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check this condition here. It does not seems to be doing what you aiming to do in the patch/commit description.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, seems to be part of another patch.
Do I recommit? It seems I cannot amend (actually, I can but it detects no difference if I try)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please. Try to amend all the commits and make this patch a single shot. addressing those comments.

#endif
sec_auditlog_write_producer_header_json(msr, g);

/* Server */
Expand Down
17 changes: 16 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,21 @@ AC_ARG_ENABLE(filename-logging,
log_filename=''
])

# Disable logging of log producer
AC_ARG_ENABLE(log-producer-logging,
AS_HELP_STRING([--enable-log-producer-logging],
[Enable logging of log producer in audit log when log level < 9. This is the default]),
[
if test "$enableval" != "no"; then
log_producer=
else
log_producer="-DLOG_NO_PRODUCER"
fi
],
[
log_producer=''
])

# Ignore configure errors
AC_ARG_ENABLE(errors,
AS_HELP_STRING([--disable-errors],
Expand Down Expand Up @@ -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_producer"

APXS_WRAPPER=build/apxs-wrapper
APXS_EXTRA_CFLAGS=""
Expand Down