[PATCH 0/5] More service logging to stderr

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 22 May 16:04 +0200
(address . guix-patches@gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
cover.1716386553.git.ludo@gnu.org
Hello,

This changes a few core services to log to stderr rather than
syslog, in light of the improvements made for the upcoming
Shepherd 1.0: ‘herd status’ displaying recently logged messages,
and built-in log rotation.

Thoughts?

Ludo’.

Ludovic Courtès (5):
services: nscd: ‘log-file’ defaults to #f.
services: tor: Log to stderr rather than syslog.
services: dbus: Log to stderr rather than syslog.
services: avahi: Use socket activation and log to stderr.
services: darkstat: Depend on ‘user-processes’.

doc/guix.texi | 8 +++++---
gnu/services/avahi.scm | 14 +++++++++-----
gnu/services/base.scm | 2 +-
gnu/services/dbus.scm | 8 ++++----
gnu/services/monitoring.scm | 2 +-
gnu/services/networking.scm | 5 +----
6 files changed, 21 insertions(+), 18 deletions(-)


base-commit: 9c3a8a380bcfebdb77af61532e7bfec523d7bde8
--
2.41.0
L
L
Ludovic Courtès wrote on 22 May 16:53 +0200
[PATCH 1/5] services: nscd: ‘log-file ’ defaults to #f.
(address . 71118@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
91683e6a6059df7816833d4e4d1e3bfc43aa74e7.1716386553.git.ludo@gnu.org
* gnu/services/base.scm (<nscd-configuration>)[log-file]: Default to #f.
* doc/guix.texi (Base Services): Clarify documentation.

Change-Id: Ia75914fc2665db13bef688d53659083a615ebef4
---
doc/guix.texi | 8 +++++---
gnu/services/base.scm | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)

Toggle diff (34 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 8073e3f6d49..0055724e658 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19446,9 +19446,11 @@ Base Services
Package object denoting the GNU C Library providing the @command{nscd}
command.
-@item @code{log-file} (default: @code{"/var/log/nscd.log"})
-Name of the nscd log file. This is where debugging output goes when
-@code{debug-level} is strictly positive.
+@item @code{log-file} (default: @code{#f})
+Name of the nscd log file. Debugging output goes to that file when
+@code{debug-level} is strictly positive, or to standard error if it is
+@code{#f}. Regular messages are written to syslog when
+@code{debug-level} is zero, regardless of the value of @code{log-file}.
@item @code{debug-level} (default: @code{0})
Integer denoting the debugging levels. Higher numbers mean that more
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 85160bd3abb..984670cd32c 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1285,7 +1285,7 @@ (define-record-type* <nscd-configuration> nscd-configuration
make-nscd-configuration
nscd-configuration?
(log-file nscd-configuration-log-file ;string
- (default "/var/log/nscd.log"))
+ (default #f))
(debug-level nscd-debug-level ;integer
(default 0))
;; TODO: See nscd.conf in glibc for other options to add.
--
2.41.0
L
L
Ludovic Courtès wrote on 22 May 16:53 +0200
[PATCH 2/5] services: tor: Log to stderr rather than syslog.
(address . 71118@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
e1fe5dcf2571fcf24a2187ea0d2809db5ff32c8c.1716386553.git.ludo@gnu.org
* gnu/services/networking.scm (tor-configuration->torrc): Change ‘Log’
directive to ‘stderr’.
(tor-shepherd-service): Remove /dev/log file system mapping.

Change-Id: I2e33ad8033f884ce59d929a4181172325331efe0
---
gnu/services/networking.scm | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

Toggle diff (25 lines)
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 8e64e529abf..378e117a869 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -1001,7 +1001,7 @@ (define (tor-configuration->torrc config)
(display "\
### These lines were generated from your system configuration:
DataDirectory /var/lib/tor
-Log notice syslog\n" port)
+Log notice stderr\n" port)
(when (eq? 'unix '#$socks-socket-type)
(display "\
SocksPort unix:/var/run/tor/socks-sock
@@ -1046,9 +1046,6 @@ (define (tor-shepherd-service config)
(source "/var/lib/tor")
(target source)
(writable? #t))
- (file-system-mapping
- (source "/dev/log") ;for syslog
- (target source))
(file-system-mapping
(source "/var/run/tor")
(target source)
--
2.41.0
L
L
Ludovic Courtès wrote on 22 May 16:53 +0200
[PATCH 3/5] services: dbus: Log to stderr rather than syslog.
(address . 71118@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
9fed6be4971d5b89621dd68db2597898eecf91b1.1716386553.git.ludo@gnu.org
* gnu/services/dbus.scm (dbus-shepherd-service): Remove ‘--syslog-only’
option and pass #:log-file unconditionally.

Change-Id: I9e42f241e08b95ff01e9ad69551bc2c7ce869d6d
---
gnu/services/dbus.scm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Toggle diff (29 lines)
diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm
index 8dee91a3f7b..1e1380185a4 100644
--- a/gnu/services/dbus.scm
+++ b/gnu/services/dbus.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2017, 2019-2021, 2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
@@ -234,12 +234,12 @@ (define dbus-shepherd-service
(requirement '(user-processes syslogd))
(start #~(make-forkexec-constructor
(list (string-append #$dbus "/bin/dbus-daemon")
- "--nofork" "--system" "--syslog-only")
+ "--nofork" "--system")
+ #:log-file "/var/log/dbus-daemon.log"
#$@(if verbose?
;; Since the verbose output goes to the console,
;; not syslog, add a log file to capture it.
- '(#:environment-variables '("DBUS_VERBOSE=1")
- #:log-file "/var/log/dbus-daemon.log")
+ '(#:environment-variables '("DBUS_VERBOSE=1"))
'())
#:pid-file "/run/dbus/pid"))
(stop #~(make-kill-destructor)))))))
--
2.41.0
L
L
Ludovic Courtès wrote on 22 May 16:53 +0200
[PATCH 4/5] services: avahi: Use socket activation and log to stderr.
(address . 71118@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
4c2a4c6f80531b1e051c00c9d2f12cfec8dcf85b.1716386553.git.ludo@gnu.org
* gnu/services/avahi.scm (avahi-shepherd-service): Change to systemd
style. Remove ‘--daemonize’ option and #:pid-file. Add #:lazy-start?
and #:log-file.

Change-Id: I1915243f057ff3bbe281f46f17826f24b124f659
---
gnu/services/avahi.scm | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/services/avahi.scm b/gnu/services/avahi.scm
index 1c4220e490b..9352492bbda 100644
--- a/gnu/services/avahi.scm
+++ b/gnu/services/avahi.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014-2020, 2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014-2020, 2022, 2024 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -131,13 +131,17 @@ (define (avahi-shepherd-service config)
(provision '(avahi-daemon))
(requirement '(user-processes dbus-system networking))
- (start #~(make-forkexec-constructor
+ (start #~(make-systemd-constructor
(list #$(file-append avahi "/sbin/avahi-daemon")
- "--daemonize"
#$@(if debug? #~("--debug") #~())
"-f" #$config)
- #:pid-file "/run/avahi-daemon/pid"))
- (stop #~(make-kill-destructor))
+ (list (endpoint
+ (make-socket-address
+ AF_UNIX
+ "/run/avahi-daemon/socket")))
+ #:lazy-start? #f
+ #:log-file "/var/log/avahi-daemon.log"))
+ (stop #~(make-systemd-destructor))
(actions (list (shepherd-configuration-action config)))))))
(define avahi-service-type
--
2.41.0
L
L
Ludovic Courtès wrote on 22 May 16:53 +0200
[PATCH 5/5] services: darkstat: Depend on ‘user-processes’.
(address . 71118@debbugs.gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
04823875cab4d8bc0277827abbc3e511dee04c4a.1716386553.git.ludo@gnu.org
* gnu/services/monitoring.scm (darkstat-shepherd-service): Add
‘user-processes’ to ‘requirement’.

Change-Id: I6abaefd88c6075a0379e5867838653765dfaa08e
---
gnu/services/monitoring.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/services/monitoring.scm b/gnu/services/monitoring.scm
index e698040078e..0a93c907eea 100644
--- a/gnu/services/monitoring.scm
+++ b/gnu/services/monitoring.scm
@@ -132,7 +132,7 @@ (define darkstat-shepherd-service
(shepherd-service
(documentation "Network statistics gatherer.")
(provision '(darkstat))
- (requirement '(networking))
+ (requirement '(user-processes networking))
(start #~(make-forkexec-constructor
(list #$(file-append package "/sbin/darkstat")
"-i" #$interface
--
2.41.0
M
M
Maxim Cournoyer wrote on 22 May 19:22 +0200
Re: [bug#71118] [PATCH 1/5] services: nscd: ‘log -file’ defaults to #f.
(name . Ludovic Courtès)(address . ludo@gnu.org)
871q5t4v96.fsf@gmail.com
Hi Ludovic,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (26 lines)
> * gnu/services/base.scm (<nscd-configuration>)[log-file]: Default to #f.
> * doc/guix.texi (Base Services): Clarify documentation.
>
> Change-Id: Ia75914fc2665db13bef688d53659083a615ebef4
> ---
> doc/guix.texi | 8 +++++---
> gnu/services/base.scm | 2 +-
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 8073e3f6d49..0055724e658 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -19446,9 +19446,11 @@ Base Services
> Package object denoting the GNU C Library providing the @command{nscd}
> command.
>
> -@item @code{log-file} (default: @code{"/var/log/nscd.log"})
> -Name of the nscd log file. This is where debugging output goes when
> -@code{debug-level} is strictly positive.
> +@item @code{log-file} (default: @code{#f})
> +Name of the nscd log file. Debugging output goes to that file when
> +@code{debug-level} is strictly positive, or to standard error if it is
> +@code{#f}. Regular messages are written to syslog when
> +@code{debug-level} is zero, regardless of the value of @code{log-file}.

Is it not a bit counter-intuitive, to have a 'log-file' field that users
can set, but debug logs not going there? Perhaps we should get rid of
it entirely instead?

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 May 19:25 +0200
(name . Ludovic Courtès)(address . ludo@gnu.org)
87wmnl3gio.fsf@gmail.com
Hi Ludo,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (26 lines)
> * gnu/services/base.scm (<nscd-configuration>)[log-file]: Default to #f.
> * doc/guix.texi (Base Services): Clarify documentation.
>
> Change-Id: Ia75914fc2665db13bef688d53659083a615ebef4
> ---
> doc/guix.texi | 8 +++++---
> gnu/services/base.scm | 2 +-
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 8073e3f6d49..0055724e658 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -19446,9 +19446,11 @@ Base Services
> Package object denoting the GNU C Library providing the @command{nscd}
> command.
>
> -@item @code{log-file} (default: @code{"/var/log/nscd.log"})
> -Name of the nscd log file. This is where debugging output goes when
> -@code{debug-level} is strictly positive.
> +@item @code{log-file} (default: @code{#f})
> +Name of the nscd log file. Debugging output goes to that file when
> +@code{debug-level} is strictly positive, or to standard error if it is
> +@code{#f}. Regular messages are written to syslog when
> +@code{debug-level} is zero, regardless of the value of @code{log-file}.

My initial reading of the above was wrong. I guess it's fine, though I
find the special case logging to /dev/error when debug-level == 0
despite log-file being set a bit surprising still.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 May 19:28 +0200
Re: [bug#71118] [PATCH 2/5] services: tor: Log to stderr rather than syslog.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 71118@debbugs.gnu.org)
87sey93get.fsf@gmail.com
Hi Ludovic,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (30 lines)
> * gnu/services/networking.scm (tor-configuration->torrc): Change ‘Log’
> directive to ‘stderr’.
> (tor-shepherd-service): Remove /dev/log file system mapping.
>
> Change-Id: I2e33ad8033f884ce59d929a4181172325331efe0
> ---
> gnu/services/networking.scm | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
> index 8e64e529abf..378e117a869 100644
> --- a/gnu/services/networking.scm
> +++ b/gnu/services/networking.scm
> @@ -1001,7 +1001,7 @@ (define (tor-configuration->torrc config)
> (display "\
> ### These lines were generated from your system configuration:
> DataDirectory /var/lib/tor
> -Log notice syslog\n" port)
> +Log notice stderr\n" port)
> (when (eq? 'unix '#$socks-socket-type)
> (display "\
> SocksPort unix:/var/run/tor/socks-sock
> @@ -1046,9 +1046,6 @@ (define (tor-shepherd-service config)
> (source "/var/lib/tor")
> (target source)
> (writable? #t))
> - (file-system-mapping
> - (source "/dev/log") ;for syslog
> - (target source))

I see no functional change here; do I understand that Shepherd 1.0 will
now log (by default?) to /dev/error (stderr) instead of /dev/log
(syslog)? What is the rationale for such change?

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 May 19:30 +0200
Re: [bug#71118] [PATCH 3/5] services: dbus: Log to stderr rather than syslog.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 71118@debbugs.gnu.org)
87o78x3gbn.fsf@gmail.com
Hello,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (36 lines)
> * gnu/services/dbus.scm (dbus-shepherd-service): Remove ‘--syslog-only’
> option and pass #:log-file unconditionally.
>
> Change-Id: I9e42f241e08b95ff01e9ad69551bc2c7ce869d6d
> ---
> gnu/services/dbus.scm | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm
> index 8dee91a3f7b..1e1380185a4 100644
> --- a/gnu/services/dbus.scm
> +++ b/gnu/services/dbus.scm
> @@ -1,5 +1,5 @@
> ;;; GNU Guix --- Functional package management for GNU
> -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
> +;;; Copyright © 2013-2017, 2019-2021, 2024 Ludovic Courtès <ludo@gnu.org>
> ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
> ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
> ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
> @@ -234,12 +234,12 @@ (define dbus-shepherd-service
> (requirement '(user-processes syslogd))
> (start #~(make-forkexec-constructor
> (list (string-append #$dbus "/bin/dbus-daemon")
> - "--nofork" "--system" "--syslog-only")
> + "--nofork" "--system")
> + #:log-file "/var/log/dbus-daemon.log"
> #$@(if verbose?
> ;; Since the verbose output goes to the console,
> ;; not syslog, add a log file to capture it.
> - '(#:environment-variables '("DBUS_VERBOSE=1")
> - #:log-file "/var/log/dbus-daemon.log")
> + '(#:environment-variables '("DBUS_VERBOSE=1"))
> '())
> #:pid-file "/run/dbus/pid"))
> (stop #~(make-kill-destructor)))))))

How does logging to a file instead of to /dev/log help Shepherd
producing better output? Does it read the log file? If so, couldn't it read
syslog as well?

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 May 19:30 +0200
Re: [bug#71118] [PATCH 5/5] services: darkstat: Depend on ‘user-processes’.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 71118@debbugs.gnu.org)
87jzjl3gak.fsf@gmail.com
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (5 lines)
> * gnu/services/monitoring.scm (darkstat-shepherd-service): Add
> ‘user-processes’ to ‘requirement’.
>
> Change-Id: I6abaefd88c6075a0379e5867838653765dfaa08e

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail>

--
Thanks,
Maxim
L
L
Ludovic Courtès wrote on 23 May 11:24 +0200
Re: [bug#71118] [PATCH 2/5] services: tor: Log to stderr rather than syslog.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 71118@debbugs.gnu.org)
8734q8c23o.fsf@gnu.org
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (8 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> * gnu/services/networking.scm (tor-configuration->torrc): Change ‘Log’
>> directive to ‘stderr’.
>> (tor-shepherd-service): Remove /dev/log file system mapping.
>>
>> Change-Id: I2e33ad8033f884ce59d929a4181172325331efe0

[...]

Toggle quote (4 lines)
> I see no functional change here; do I understand that Shepherd 1.0 will
> now log (by default?) to /dev/error (stderr) instead of /dev/log
> (syslog)? What is the rationale for such change?

Shepherd by itself doesn’t make any decision; it’s up to the service to
choose whether to log to stdout/stderr or to syslog.

As I wrote in the cover letter at https://issues.guix.gnu.org/71118,
Shepherd 0.10 already does a good job at handling logs, which makes
gives less of an incentive to use syslogd; on top of that, 1.0 (current
‘devel’ branch) can display messages logged to stderr/stdout directly at
the command line:

Toggle snippet (23 lines)
$ sudo /run/current-system/profile/bin/herd status guix-publish
Status of guix-publish:
It is running since Tue 21 May 2024 08:44:57 AM CEST (2 days ago).
PID 518 running: /gnu/store/12jb83hlngklkymn52yzaw7kldr2qiwp-guix-1.4.0-20.37719d3/bin/guix publish -u guix-publish -p 8123 -C zstd:3 -C gzip:3 --nar-path=nar --listen=0.0.0.0 --advertise
It is enabled.
Provides (guix-publish).
Requires (user-processes guix-daemon avahi-daemon).
Will be respawned.
Log file: /var/log/guix-publish.log.

Recent messages:
2024-05-21 10:56:10 In web/request.scm:
2024-05-21 10:56:10 205:32 4 (read-request #<closed: file 7f5f48418af0> _)
2024-05-21 10:56:10 In web/http.scm:
2024-05-21 10:56:10 1158:12 3 (read-request-line _)
2024-05-21 10:56:10 1066:2 2 (parse-request-uri _ _ _)
2024-05-21 10:56:10 In ice-9/boot-9.scm:
2024-05-21 10:56:10 1685:16 1 (raise-exception _ #:continuable? _)
2024-05-21 10:56:10 1685:16 0 (raise-exception _ #:continuable? _)
2024-05-21 10:56:10 .Bad request: Invalid URI: 85.94.204.153:31204
2024-05-21 10:56:10

It’s a slight quality-of-life improvement.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 23 May 11:26 +0200
Re: [bug#71118] [PATCH 1/5] services: nscd: ‘log -file’ defaults to #f.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87y180anh0.fsf@gnu.org
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (7 lines)
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> * gnu/services/base.scm (<nscd-configuration>)[log-file]: Default to #f.
>> * doc/guix.texi (Base Services): Clarify documentation.
>>
>> Change-Id: Ia75914fc2665db13bef688d53659083a615ebef4

[...]

Toggle quote (9 lines)
>> +@item @code{log-file} (default: @code{#f})
>> +Name of the nscd log file. Debugging output goes to that file when
>> +@code{debug-level} is strictly positive, or to standard error if it is
>> +@code{#f}. Regular messages are written to syslog when
>> +@code{debug-level} is zero, regardless of the value of @code{log-file}.
>
> Is it not a bit counter-intuitive, to have a 'log-file' field that users
> can set, but debug logs not going there?

Yeah, I had to check the code of nscd in libc, and it’s this weird.

Toggle quote (2 lines)
> Perhaps we should get rid of it entirely instead?

I’d rather keep it to avoid gratuitous breakage and also because it’s
occasionally useful when one needs to debug NSS/nscd issues.

Ludo’.
M
M
Maxim Cournoyer wrote on 24 May 14:44 +0200
Re: [bug#71118] [PATCH 2/5] services: tor: Log to stderr rather than syslog.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 71118@debbugs.gnu.org)
87zfsfidla.fsf@gmail.com
Hi Ludovic,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (21 lines)
> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> * gnu/services/networking.scm (tor-configuration->torrc): Change ‘Log’
>>> directive to ‘stderr’.
>>> (tor-shepherd-service): Remove /dev/log file system mapping.
>>>
>>> Change-Id: I2e33ad8033f884ce59d929a4181172325331efe0
>
> [...]
>
>> I see no functional change here; do I understand that Shepherd 1.0 will
>> now log (by default?) to /dev/error (stderr) instead of /dev/log
>> (syslog)? What is the rationale for such change?
>
> Shepherd by itself doesn’t make any decision; it’s up to the service to
> choose whether to log to stdout/stderr or to syslog.

I see.

Toggle quote (30 lines)
> As I wrote in the cover letter at https://issues.guix.gnu.org/71118,
> Shepherd 0.10 already does a good job at handling logs, which makes
> gives less of an incentive to use syslogd; on top of that, 1.0 (current
> ‘devel’ branch) can display messages logged to stderr/stdout directly at
> the command line:
>
> $ sudo /run/current-system/profile/bin/herd status guix-publish
> Status of guix-publish:
> It is running since Tue 21 May 2024 08:44:57 AM CEST (2 days ago).
> PID 518 running: /gnu/store/12jb83hlngklkymn52yzaw7kldr2qiwp-guix-1.4.0-20.37719d3/bin/guix publish -u guix-publish -p 8123 -C zstd:3 -C gzip:3 --nar-path=nar --listen=0.0.0.0 --advertise
> It is enabled.
> Provides (guix-publish).
> Requires (user-processes guix-daemon avahi-daemon).
> Will be respawned.
> Log file: /var/log/guix-publish.log.
>
> Recent messages:
> 2024-05-21 10:56:10 In web/request.scm:
> 2024-05-21 10:56:10 205:32 4 (read-request #<closed: file 7f5f48418af0> _)
> 2024-05-21 10:56:10 In web/http.scm:
> 2024-05-21 10:56:10 1158:12 3 (read-request-line _)
> 2024-05-21 10:56:10 1066:2 2 (parse-request-uri _ _ _)
> 2024-05-21 10:56:10 In ice-9/boot-9.scm:
> 2024-05-21 10:56:10 1685:16 1 (raise-exception _ #:continuable? _)
> 2024-05-21 10:56:10 1685:16 0 (raise-exception _ #:continuable? _)
> 2024-05-21 10:56:10 .Bad request: Invalid URI: 85.94.204.153:31204
> 2024-05-21 10:56:10
>
> It’s a slight quality-of-life improvement.

I agree that's more convenient than grepping /var/log/messages.

Thanks for explaining and for the Shepherd improvements!

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 24 May 14:45 +0200
Re: [bug#71118] [PATCH 1/5] services: nscd: ‘log -file’ defaults to #f.
(name . Ludovic Courtès)(address . ludo@gnu.org)
87v833idja.fsf@gmail.com
Hi,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (24 lines)
> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> * gnu/services/base.scm (<nscd-configuration>)[log-file]: Default to #f.
>>> * doc/guix.texi (Base Services): Clarify documentation.
>>>
>>> Change-Id: Ia75914fc2665db13bef688d53659083a615ebef4
>
> [...]
>
>>> +@item @code{log-file} (default: @code{#f})
>>> +Name of the nscd log file. Debugging output goes to that file when
>>> +@code{debug-level} is strictly positive, or to standard error if it is
>>> +@code{#f}. Regular messages are written to syslog when
>>> +@code{debug-level} is zero, regardless of the value of @code{log-file}.
>>
>> Is it not a bit counter-intuitive, to have a 'log-file' field that users
>> can set, but debug logs not going there?
>
> Yeah, I had to check the code of nscd in libc, and it’s this weird.

Haha!

Toggle quote (5 lines)
>> Perhaps we should get rid of it entirely instead?
>
> I’d rather keep it to avoid gratuitous breakage and also because it’s
> occasionally useful when one needs to debug NSS/nscd issues.

OK. Sounds reasonable. I didn't know the weirdness was carried from
the underlying software rather than our own.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 24 May 14:46 +0200
Re: [bug#71118] [PATCH 0/5] More service logging to stderr
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 71118@debbugs.gnu.org)
87r0dridin.fsf@gmail.com
Hello,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (19 lines)
> Hello,
>
> This changes a few core services to log to stderr rather than
> syslog, in light of the improvements made for the upcoming
> Shepherd 1.0: ‘herd status’ displaying recently logged messages,
> and built-in log rotation.
>
> Thoughts?
>
> Ludo’.
>
> Ludovic Courtès (5):
> services: nscd: ‘log-file’ defaults to #f.
> services: tor: Log to stderr rather than syslog.
> services: dbus: Log to stderr rather than syslog.
> services: avahi: Use socket activation and log to stderr.
> services: darkstat: Depend on ‘user-processes’.
>

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail>

--
Thanks,
Maxim
L
L
Ludovic Courtès wrote on 2 Jun 20:57 +0200
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 71118-done@debbugs.gnu.org)
87v82rjhpd.fsf@gnu.org
Hi,

Pushed:

20e7b892189 * services: darkstat: Depend on ‘user-processes’.
3298ec0200a * services: avahi: Use socket activation and log to stderr.
b9b0f0a995e * services: dbus: Log to stderr rather than syslog.
49e9c9ec3e8 * services: tor: Log to stderr rather than syslog.
8f0878da8d1 * services: nscd: ‘log-file’ defaults to #f.

Thanks for reviewing!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 71118@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 71118
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch