From 494eb0c22a67f0a9672a53f8941ad6fecf291a77 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Sun, 31 Oct 2021 11:59:30 +1100 Subject: [PATCH] debug: Add new smb.conf option "debug syslog format" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Schwenke Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Mon Nov 1 07:29:47 UTC 2021 on sn-devel-184 --- .../logging/debughirestimestamp.xml | 3 ++- .../smbdotconf/logging/debugsyslogformat.xml | 21 +++++++++++++++++++ lib/param/loadparm.c | 2 ++ lib/util/debug_s3.c | 2 ++ source3/param/loadparm.c | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 docs-xml/smbdotconf/logging/debugsyslogformat.xml diff --git a/docs-xml/smbdotconf/logging/debughirestimestamp.xml b/docs-xml/smbdotconf/logging/debughirestimestamp.xml index 72598d757ca..79d928ab3d9 100644 --- a/docs-xml/smbdotconf/logging/debughirestimestamp.xml +++ b/docs-xml/smbdotconf/logging/debughirestimestamp.xml @@ -9,7 +9,8 @@ - Note that the parameter must be on for this to have an effect. + Note that the parameter or + must be on for this to have an effect. diff --git a/docs-xml/smbdotconf/logging/debugsyslogformat.xml b/docs-xml/smbdotconf/logging/debugsyslogformat.xml new file mode 100644 index 00000000000..f943f3a5323 --- /dev/null +++ b/docs-xml/smbdotconf/logging/debugsyslogformat.xml @@ -0,0 +1,21 @@ + + + + With this option enabled, debug messages are printed in a + single-line format like that traditionally produced by syslog. + The timestamp consists of an abbreviated month, space-padded date, + and time including seconds. This is followed by the hostname and + the program name, with the process-ID in square brackets. + + + + If is also enabled + then an RFC5424 timestamp is used instead. + + + +no + diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 2eac1ba7c38..9c725402758 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -2559,6 +2559,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lpcfg_do_global_parameter(lp_ctx, "debug timestamp", "Yes"); lpcfg_do_global_parameter(lp_ctx, "debug prefix timestamp", "No"); lpcfg_do_global_parameter(lp_ctx, "debug hires timestamp", "Yes"); + lpcfg_do_global_parameter(lp_ctx, "debug syslog format", "No"); lpcfg_do_global_parameter(lp_ctx, "debug pid", "No"); lpcfg_do_global_parameter(lp_ctx, "debug uid", "No"); lpcfg_do_global_parameter(lp_ctx, "debug class", "No"); @@ -3102,6 +3103,7 @@ static bool lpcfg_update(struct loadparm_context *lp_ctx) settings.timestamp_logs = lp_ctx->globals->timestamp_logs; settings.debug_prefix_timestamp = lp_ctx->globals->debug_prefix_timestamp; settings.debug_hires_timestamp = lp_ctx->globals->debug_hires_timestamp; + settings.debug_syslog_format = lp_ctx->globals->debug_syslog_format; settings.debug_pid = lp_ctx->globals->debug_pid; settings.debug_uid = lp_ctx->globals->debug_uid; settings.debug_class = lp_ctx->globals->debug_class; diff --git a/lib/util/debug_s3.c b/lib/util/debug_s3.c index 151227c3419..1fd8637a65f 100644 --- a/lib/util/debug_s3.c +++ b/lib/util/debug_s3.c @@ -36,6 +36,7 @@ bool reopen_logs(void) .timestamp_logs = lp_timestamp_logs(), .debug_prefix_timestamp = lp_debug_prefix_timestamp(), .debug_hires_timestamp = lp_debug_hires_timestamp(), + .debug_syslog_format = lp_debug_syslog_format(), .debug_pid = lp_debug_pid(), .debug_uid = lp_debug_uid(), .debug_class = lp_debug_class(), @@ -60,6 +61,7 @@ bool reopen_logs(void) .timestamp_logs = true, .debug_prefix_timestamp = false, .debug_hires_timestamp = true, + .debug_syslog_format = false, .debug_pid = false, .debug_uid = false, .debug_class = false, diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 6c9830563c3..f35db213c14 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -675,6 +675,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals) lpcfg_string_set(Globals.ctx, &Globals.log_level, "0"); Globals.debug_prefix_timestamp = false; Globals.debug_hires_timestamp = true; + Globals.debug_syslog_format = false; Globals.debug_pid = false; Globals.debug_uid = false; Globals.debug_class = false;