unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* System log (syslogd) for the Shepherd
@ 2024-07-21 13:27 Ludovic Courtès
  2024-08-13 13:55 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2024-07-21 13:27 UTC (permalink / raw)
  To: guix-devel

Hello Guix!

I recently pushed a ‘wip-syslogd’ branch in the Shepherd, which should
be ready to merge in ‘devel’ in the coming days.  It implements an
in-process “system log” service that does the same job as good’ol
syslogd as currently used in Guix System (info "(inetutils) syslogd
invocation").

This is again an optional service.  The goal here is to make sure
shepherd can take care of everything related to service logging because
that’s fundamentally part of its job.

A concrete advantage of this built-in syslogd is that it can start
logging earlier and can log until the very end—currently syslogd starts
relatively late and terminates relatively early, which makes it hard to
debug shutdown problems.  See “sudo herd graph | xdot -” to visualize
where ‘syslogd’ currently is in the dependency graph.

The main parts are in place.  What’s still missing is: reading kernel
messages, integrating with the ‘log-rotation’ service, and documenting.

Feedback welcome!

Ludo’.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: System log (syslogd) for the Shepherd
  2024-07-21 13:27 System log (syslogd) for the Shepherd Ludovic Courtès
@ 2024-08-13 13:55 ` Ludovic Courtès
  2024-08-23 19:08   ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2024-08-13 13:55 UTC (permalink / raw)
  To: guix-devel

Hello!

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

> I recently pushed a ‘wip-syslogd’ branch in the Shepherd, which should
> be ready to merge in ‘devel’ in the coming days.  It implements an
> in-process “system log” service that does the same job as good’ol
> syslogd as currently used in Guix System (info "(inetutils) syslogd
> invocation").

This is now part of the ‘devel’ branch.  This is pretty much the last
feature I wanted to have for 1.0.

If you want to use this new ‘system-log’ service instead of syslogd,
here’s how you can change your system configuration:

--8<---------------cut here---------------start------------->8---
(define system-log-service-type
  (shepherd-service-type
   'shepherd-system-log
   (const (shepherd-service
           (documentation "Shepherd's built-in system log (syslogd).")
           (provision '(system-log syslogd))
           (modules '((shepherd service system-log)))
           (free-form #~(system-log-service))))
   #t
   (description
    "Shepherd's built-in system log (syslogd).")))

(operating-system
  ;; …
  (services (cons* (service system-log-service-type)
                   ;; …
                   (modify-services %desktop-services
                     ;; …
                     (delete syslog-service-type))))) ;replaced by the Shepherd's
--8<---------------cut here---------------end--------------->8---

You need to be using the Shepherd from the ‘devel’ branch of course; see
the instructions in the Shepherd’s ‘README’ for this.

Once running, it gives something like this:

--8<---------------cut here---------------start------------->8---
$ sudo /run/current-system/profile/bin/herd status syslogd
Status of system-log:
  It is running since Sun 11 Aug 2024 11:23:40 PM CEST (40 hours ago).
  Running value is "#<system-log 7fc04762de00>".
  It is enabled.
  Provides: system-log syslogd.
  Will not be respawned.
  Log files: /var/log/messages /dev/tty12 /var/log/debug /var/log/secure.

Recent messages:
  2024-08-13 14:47:29 localhost shepherd[1]: service names: 72; heap: 36.89 MiB; file descriptors: 47
  2024-08-13 15:00:00 localhost shepherd[1]: Timer 'gc' spawned process 16427.
  2024-08-13 15:00:00 localhost shepherd[1]: Registering new logger for gc.
  2024-08-13 15:00:00 localhost shepherd[1]: [guix] guix gc: already 10699.16 MiBs available on /gnu/store, nothing to do
  2024-08-13 15:00:00 localhost shepherd[1]: Process 16427 of timer 'gc' terminated with status 0 after 0 seconds.
  2024-08-13 15:07:29 localhost shepherd[1]: service names: 72; heap: 36.89 MiB; file descriptors: 47
  2024-08-13 15:27:29 localhost shepherd[1]: service names: 72; heap: 36.89 MiB; file descriptors: 47
  2024-08-13 15:47:29 localhost shepherd[1]: service names: 72; heap: 36.89 MiB; file descriptors: 47
  2024-08-13 15:50:53 localhost sudo:     ludo : TTY=pts/0 ; PWD=/home/ludo/src/guix ; USER=root ; COMMAND=/run/current-system/profile/bin/herd status syslogd
  2024-08-13 15:50:53 localhost sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
--8<---------------cut here---------------end--------------->8---

And it’s now integrated with the new ‘log-rotation’ service:

--8<---------------cut here---------------start------------->8---
$ sudo herd files log-rotation
/var/log/mcron.log      mcron
/var/log/messages       system-log
/dev/tty12      system-log
/var/log/debug  system-log
/var/log/secure system-log
/var/log/guix-publish.log       guix-publish
/var/log/avahi-daemon.log       avahi-daemon
/var/log/dbus-daemon.log        dbus-system
/var/log/ntpd.log       ntpd
/var/log/guix-daemon.log        guix-daemon
--8<---------------cut here---------------end--------------->8---

Ludo’.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: System log (syslogd) for the Shepherd
  2024-08-13 13:55 ` Ludovic Courtès
@ 2024-08-23 19:08   ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Lechner via Development of GNU Guix and the GNU System distribution. @ 2024-08-23 19:08 UTC (permalink / raw)
  To: Ludovic Courtès, guix-devel

Hi Ludo'

On Tue, Aug 13 2024, Ludovic Courtès wrote:

> This is pretty much the last feature I wanted to have for 1.0.

Thanks for this feature!  I believe it works as advertised.

Kind regards
Felix


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-23 19:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-21 13:27 System log (syslogd) for the Shepherd Ludovic Courtès
2024-08-13 13:55 ` Ludovic Courtès
2024-08-23 19:08   ` Felix Lechner via Development of GNU Guix and the GNU System distribution.

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).