aboutsummaryrefslogtreecommitdiff
path: root/gnu/services/admin.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-07-31 23:35:27 +0200
committerLudovic Courtès <ludo@gnu.org>2022-08-01 00:02:04 +0200
commit7d0ebc467ff2a76b75ef0817ac24af4b22c0ab8e (patch)
tree73ac946002cfc9fe983ec6da38dc945682ed460c /gnu/services/admin.scm
parent4de445f3dae5f5b42d59003cceddecfb296fb73b (diff)
downloadguix-7d0ebc467ff2a76b75ef0817ac24af4b22c0ab8e.tar
guix-7d0ebc467ff2a76b75ef0817ac24af4b22c0ab8e.tar.gz
services: rottlog: More convenient default options for <log-rotation>.
* gnu/services/admin.scm (%default-log-rotation-options): New variable. (%default-rotations): Use it. * gnu/services/cuirass.scm (cuirass-log-rotations): Likewise. * doc/guix.texi (Log Rotation): Adjust accordingly.
Diffstat (limited to 'gnu/services/admin.scm')
-rw-r--r--gnu/services/admin.scm18
1 files changed, 12 insertions, 6 deletions
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