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.
This commit is contained in:
Ludovic Courtès 2016-10-03 14:39:25 +02:00
parent d5b0c9024e
commit 4d67ed70a3
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 8 additions and 11 deletions

View File

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -44,10 +45,12 @@
;;; Code: ;;; Code:
(define %rotated-files (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) (define (syslog-rotation-config files)
#~(#$file " { #~(string-append #$(string-join files ",")
" {
sharedscripts sharedscripts
postrotate postrotate
" #$coreutils "/bin/kill -HUP $(cat /var/run/syslog.pid) 2> /dev/null " #$coreutils "/bin/kill -HUP $(cat /var/run/syslog.pid) 2> /dev/null
@ -58,8 +61,6 @@
(define (simple-rotation-config file) (define (simple-rotation-config file)
(string-append file " { (string-append file " {
sharedscripts sharedscripts
postrotate
endscript
} }
")) "))
@ -68,11 +69,7 @@
,(computed-file "rottlog.weekly" ,(computed-file "rottlog.weekly"
#~(call-with-output-file #$output #~(call-with-output-file #$output
(lambda (port) (lambda (port)
(display (display #$(syslog-rotation-config %rotated-files)
(string-join
(apply append '#$(map syslog-rotation-config
%rotated-files))
"")
port) port)
(display #$(simple-rotation-config (display #$(simple-rotation-config
"/var/log/shepherd.log") "/var/log/shepherd.log")