summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-10-03 14:39:25 +0200
committerLudovic Courtès <ludo@gnu.org>2016-10-03 14:47:55 +0200
commit4d67ed70a396ff0d374b93ed2b9eeccdc28c04b6 (patch)
tree40603832a2ff2a4fbd460ec48d35e66c1fbf5d1a /gnu/services
parentd5b0c9024ed174907aed4816b2607ada814a035c (diff)
downloadguix-4d67ed70a396ff0d374b93ed2b9eeccdc28c04b6.tar.gz
services: rottlog: Improve default weekly rotations.
* gnu/services/admin.scm (%rotated-files): Add "/var/log/maillog".
(syslog-rotation-config): Change parameter to 'files'.  Return a
string-append gexp for all of FILES.
(simple-rotation-config): Remove unnecessary 'postrotate' and
'endscript'.
(%default-rotations): Adjust accordingly.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/admin.scm19
1 files changed, 8 insertions, 11 deletions
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm
index 6e04039fe6..aeeec4e83b 100644
--- a/gnu/services/admin.scm
+++ b/gnu/services/admin.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -44,10 +45,12 @@
 ;;; Code:
 
 (define %rotated-files
-  '("/var/log/messages" "/var/log/secure"))
+  ;; Syslog files subject to rotation.
+  '("/var/log/messages" "/var/log/secure" "/var/log/maillog"))
 
-(define (syslog-rotation-config file)
-  #~(#$file " {
+(define (syslog-rotation-config files)
+  #~(string-append #$(string-join files ",")
+                 " {
         sharedscripts
         postrotate
         " #$coreutils "/bin/kill -HUP $(cat /var/run/syslog.pid) 2> /dev/null
@@ -58,8 +61,6 @@
 (define (simple-rotation-config file)
   (string-append file " {
         sharedscripts
-        postrotate
-        endscript
 }
 "))
 
@@ -68,12 +69,8 @@
      ,(computed-file "rottlog.weekly"
                      #~(call-with-output-file #$output
                          (lambda (port)
-                           (display
-                            (string-join
-                             (apply append '#$(map syslog-rotation-config
-                                                   %rotated-files))
-                             "")
-                            port)
+                           (display #$(syslog-rotation-config %rotated-files)
+                                    port)
                            (display #$(simple-rotation-config
                                        "/var/log/shepherd.log")
                                     port)))))))