diff options
author | Andrew Bartlett <abartlet@samba.org> | 2018-12-13 13:53:08 +1300 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2019-02-01 11:34:09 +0100 |
commit | 3145dae212c82b9e766e2ab406115b56cc3cd879 (patch) | |
tree | f386a7c51b6fbfd7a59ddd15969ab83c2fe28a2a /lib | |
parent | 2cebe0b84f58f6796cc587fdfd581edbe983a9a8 (diff) | |
download | samba-3145dae212c82b9e766e2ab406115b56cc3cd879.tar.gz |
audit_logging: Remove debug log header and JSON Authentication: prefix
Feedback from real-world users is that they really want raw JSON
strings in the log.
We can not easily remove the leading " " but the other strings above
and before the JSON are really annoying to strip back off
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13714
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
(cherry-picked from edab1318f9138c0d87de7cc7cfa5da8e29c906f8 and modified
for v4-9 by Gary Lockyer)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/audit_logging/audit_logging.c | 19 | ||||
-rw-r--r-- | lib/audit_logging/audit_logging.h | 3 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/audit_logging/audit_logging.c b/lib/audit_logging/audit_logging.c index ac08863129a..4ae18fb773b 100644 --- a/lib/audit_logging/audit_logging.c +++ b/lib/audit_logging/audit_logging.c @@ -105,13 +105,11 @@ const struct json_object json_empty_object = {.valid = false, .root = NULL}; * * Write the json object to the audit logs as a formatted string * - * @param prefix Text to be printed at the start of the log line * @param message The content of the log line. * @param debub_class The debug class to log the message with. * @param debug_level The debug level to log the message with. */ -void audit_log_json(const char* prefix, - struct json_object* message, +void audit_log_json(struct json_object* message, int debug_class, int debug_level) { @@ -126,13 +124,20 @@ void audit_log_json(const char* prefix, ctx = talloc_new(NULL); s = json_to_string(ctx, message); if (s == NULL) { - DBG_ERR("json_to_string for (%s) returned NULL, " - "JSON audit message could not written\n", - prefix); + DBG_ERR("json_to_string returned NULL, " + "JSON audit message could not written\n"); TALLOC_FREE(ctx); return; } - DEBUGC(debug_class, debug_level, ("JSON %s: %s\n", prefix, s)); + /* + * This is very strange, but we call this routine to get a log + * output without the header. JSON logs all have timestamps + * so this only makes parsing harder. + * + * We push out the raw JSON blob without a prefix, consumers + * can find such lines by the leading { + */ + DEBUGADDC(debug_class, debug_level, ("%s\n", s)); TALLOC_FREE(ctx); } diff --git a/lib/audit_logging/audit_logging.h b/lib/audit_logging/audit_logging.h index 84738d2bb93..f91efc39478 100644 --- a/lib/audit_logging/audit_logging.h +++ b/lib/audit_logging/audit_logging.h @@ -42,8 +42,7 @@ extern const struct json_object json_empty_object; #define JSON_ERROR -1 -void audit_log_json(const char *prefix, - struct json_object *message, +void audit_log_json(struct json_object *message, int debug_class, int debug_level); void audit_message_send(struct imessaging_context *msg_ctx, |