summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/guix.texi5
-rw-r--r--gnu/services/admin.scm18
-rw-r--r--gnu/services/cuirass.scm5
3 files changed, 18 insertions, 10 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 6e867839a4..271aad32f0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18811,9 +18811,10 @@ The log rotation frequency, a symbol.
 @item @code{files}
 The list of files or file glob patterns to rotate.
 
-@item @code{options} (default: @code{'()})
+@vindex %default-log-rotation-options
+@item @code{options} (default: @code{%default-log-rotation-options})
 The list of rottlog options for this rotation (@pxref{Configuration
-parameters,,, rottlog, GNU Rot[t]lg Manual}).
+parameters,,, rottlog, GNU Rot[t]log Manual}).
 
 @item @code{post-rotate} (default: @code{#f})
 Either @code{#f} or a gexp to execute once the rotation has completed.
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index 6951c7a9fd..252bedb0bd 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -40,6 +40,7 @@
             log-rotation-files
             log-rotation-options
             log-rotation-post-rotate
+            %default-log-rotation-options
 
             rottlog-configuration
             rottlog-configuration?
@@ -82,7 +83,12 @@
   (post-rotate log-rotation-post-rotate           ;#f | gexp
                (default #f))
   (options     log-rotation-options               ;list of strings
-               (default '())))
+               (default %default-log-rotation-options)))
+
+(define %default-log-rotation-options
+  ;; Default log rotation options: append ".gz" to file names.
+  '("storefile @FILENAME.@COMP_EXT"
+    "notifempty"))
 
 (define %rotated-files
   ;; Syslog files subject to rotation.
@@ -94,20 +100,20 @@
          (files %rotated-files)
 
          (frequency 'weekly)
-         (options '(;; These files are worth keeping for a few weeks.
+         (options `(;; These files are worth keeping for a few weeks.
                     "rotate 16"
                     ;; Run post-rotate once per rotation
                     "sharedscripts"
-                    ;; Append .gz to rotated files
-                    "storefile @FILENAME.@COMP_EXT"))
+
+                    ,@%default-log-rotation-options))
          ;; Restart syslogd after rotation.
          (post-rotate #~(let ((pid (call-with-input-file "/var/run/syslog.pid"
                                      read)))
                           (kill pid SIGHUP))))
         (log-rotation
          (files '("/var/log/guix-daemon.log"))
-         (options '("rotate 4"                    ;don't keep too many of them
-                    "storefile @FILENAME.@COMP_EXT")))))
+         (options `("rotate 4"                    ;don't keep too many of them
+                    ,@%default-log-rotation-options)))))
 
 (define (log-rotation->config rotation)
   "Return a string-valued gexp representing the rottlog configuration snippet
diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm
index d666d6243b..52de5ca7c0 100644
--- a/gnu/services/cuirass.scm
+++ b/gnu/services/cuirass.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
-;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
@@ -305,7 +305,8 @@
          (files (list (cuirass-configuration-log-file config)
                       (cuirass-configuration-web-log-file config)))
          (frequency 'weekly)
-         (options '("rotate 40")))))              ;worth keeping
+         (options `("rotate 40"                   ;worth keeping
+                    ,@%default-log-rotation-options)))))
 
 (define cuirass-service-type
   (service-type