]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
debug: Add new smb.conf option "debug syslog format"
authorMartin Schwenke <martin@meltin.net>
Sun, 31 Oct 2021 00:59:30 +0000 (11:59 +1100)
committerRalph Boehme <slow@samba.org>
Mon, 1 Nov 2021 07:29:47 +0000 (07:29 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Mon Nov  1 07:29:47 UTC 2021 on sn-devel-184

docs-xml/smbdotconf/logging/debughirestimestamp.xml
docs-xml/smbdotconf/logging/debugsyslogformat.xml [new file with mode: 0644]
lib/param/loadparm.c
lib/util/debug_s3.c
source3/param/loadparm.c

index 72598d757ca24c4ada33d96579c5194128a6ce9b..79d928ab3d9f3f67e4a68d7d4bf43fd8e1b78133 100644 (file)
@@ -9,7 +9,8 @@
     </para>
 
     <para>
-    Note that the parameter <smbconfoption name="debug timestamp"/> must be on for this to have an effect.
+    Note that the parameter <smbconfoption name="debug timestamp"/> or
+    <smbconfoption name="debug syslog format"/> must be on for this to have an effect.
     </para>
 
 </description>
diff --git a/docs-xml/smbdotconf/logging/debugsyslogformat.xml b/docs-xml/smbdotconf/logging/debugsyslogformat.xml
new file mode 100644 (file)
index 0000000..f943f3a
--- /dev/null
@@ -0,0 +1,21 @@
+<samba:parameter name="debug syslog format"
+                 context="G"
+                 type="boolean"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+    <para>
+    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.
+    </para>
+
+    <para>
+    If <smbconfoption name="debug hires timestamp"/> is also enabled
+    then an RFC5424 timestamp is used instead.
+    </para>
+
+</description>
+<value type="default">no</value>
+</samba:parameter>
index 2eac1ba7c3884d48c8787ff189f45ba0abb45fb8..9c725402758ad896e06ad6672277638fa3ae11be 100644 (file)
@@ -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;
index 151227c34196ce38546e45f0f494282013bb8f0c..1fd8637a65f6ce602e9891fdc876d2deb2cdd624 100644 (file)
@@ -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,
index 6c9830563c3bb168526e856196008473c014e434..f35db213c14cc7544133a411de49f1441e295d8d 100644 (file)
@@ -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;