diff mbox series

[bug#70677,1/2] services: syslog: Add extra-options argument to syslog service.

Message ID 44cb8b9fe93ffc2fb653657ea18374543d4f33db.1714490986.git.jean-baptiste.note@m4x.org
State New
Headers show
Series Improve syslog service flexibility | expand

Commit Message

Jean-Baptiste Note April 30, 2024, 3:36 p.m. UTC
* gnu/services/base.scm (<syslog-configuration>): Add extra-options field.
  (syslog-shepherd-service): Use it when running the service.

* doc/guix.texi: Document it.

Change-Id: I540d070b9a9678b45ec9fa28d6fdc761f9b3fd9a
---
 doc/guix.texi         | 3 +++
 gnu/services/base.scm | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 3a9afcd814..81e6283196 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19442,6 +19442,9 @@  Base Services
 @xref{syslogd invocation,,, inetutils, GNU Inetutils}, for more
 information on the configuration file syntax.
 
+@item @code{extra-options} (default: @code{'()})
+List of extra command-line options for @command{syslog}.
+
 @end table
 @end deftp
 
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index f35d74ee40..47565a3d5a 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1553,7 +1553,9 @@  (define-record-type* <syslog-configuration>
   (syslogd              syslog-configuration-syslogd
                         (default (file-append inetutils "/libexec/syslogd")))
   (config-file          syslog-configuration-config-file
-                        (default %default-syslog.conf)))
+                        (default %default-syslog.conf))
+  (extra-options        syslog-configuration-extra-options
+                        (default '())))
 
 ;;; Note: a static file name is used for syslog.conf so that the reload action
 ;;; work as intended.
@@ -1589,7 +1591,8 @@  (define (syslog-shepherd-service config)
    ;; action work as intended.
    (start #~(make-forkexec-constructor
              (list #$(syslog-configuration-syslogd config)
-                   #$(string-append "--rcfile=" syslog.conf))
+                   #$(string-append "--rcfile=" syslog.conf)
+                   #$@(syslog-configuration-extra-options config))
              #:file-creation-mask #o137
              #:pid-file "/var/run/syslog.pid"))
    (stop #~(make-kill-destructor))))