diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2022-07-31 23:35:27 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-08-01 00:02:04 +0200 |
| commit | 7d0ebc467ff2a76b75ef0817ac24af4b22c0ab8e (patch) | |
| tree | 73ac946002cfc9fe983ec6da38dc945682ed460c /gnu/services | |
| parent | 4de445f3dae5f5b42d59003cceddecfb296fb73b (diff) | |
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')
| -rw-r--r-- | gnu/services/admin.scm | 18 | ||||
| -rw-r--r-- | gnu/services/cuirass.scm | 5 |
2 files changed, 15 insertions, 8 deletions
diff --git a/gnu/services/admin.scm b/gnu/services/admin.scm index 6951c7a9fde..252bedb0bd2 100644 --- a/gnu/services/admin.scm +++ b/gnu/services/admin.scm | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | log-rotation-files | 40 | log-rotation-files |
| 41 | log-rotation-options | 41 | log-rotation-options |
| 42 | log-rotation-post-rotate | 42 | log-rotation-post-rotate |
| 43 | %default-log-rotation-options | ||
| 43 | 44 | ||
| 44 | rottlog-configuration | 45 | rottlog-configuration |
| 45 | rottlog-configuration? | 46 | rottlog-configuration? |
| @@ -82,7 +83,12 @@ | |||
| 82 | (post-rotate log-rotation-post-rotate ;#f | gexp | 83 | (post-rotate log-rotation-post-rotate ;#f | gexp |
| 83 | (default #f)) | 84 | (default #f)) |
| 84 | (options log-rotation-options ;list of strings | 85 | (options log-rotation-options ;list of strings |
| 85 | (default '()))) | 86 | (default %default-log-rotation-options))) |
| 87 | |||
| 88 | (define %default-log-rotation-options | ||
| 89 | ;; Default log rotation options: append ".gz" to file names. | ||
| 90 | '("storefile @FILENAME.@COMP_EXT" | ||
| 91 | "notifempty")) | ||
| 86 | 92 | ||
| 87 | (define %rotated-files | 93 | (define %rotated-files |
| 88 | ;; Syslog files subject to rotation. | 94 | ;; Syslog files subject to rotation. |
| @@ -94,20 +100,20 @@ | |||
| 94 | (files %rotated-files) | 100 | (files %rotated-files) |
| 95 | 101 | ||
| 96 | (frequency 'weekly) | 102 | (frequency 'weekly) |
| 97 | (options '(;; These files are worth keeping for a few weeks. | 103 | (options `(;; These files are worth keeping for a few weeks. |
| 98 | "rotate 16" | 104 | "rotate 16" |
| 99 | ;; Run post-rotate once per rotation | 105 | ;; Run post-rotate once per rotation |
| 100 | "sharedscripts" | 106 | "sharedscripts" |
| 101 | ;; Append .gz to rotated files | 107 | |
| 102 | "storefile @FILENAME.@COMP_EXT")) | 108 | ,@%default-log-rotation-options)) |
| 103 | ;; Restart syslogd after rotation. | 109 | ;; Restart syslogd after rotation. |
| 104 | (post-rotate #~(let ((pid (call-with-input-file "/var/run/syslog.pid" | 110 | (post-rotate #~(let ((pid (call-with-input-file "/var/run/syslog.pid" |
| 105 | read))) | 111 | read))) |
| 106 | (kill pid SIGHUP)))) | 112 | (kill pid SIGHUP)))) |
| 107 | (log-rotation | 113 | (log-rotation |
| 108 | (files '("/var/log/guix-daemon.log")) | 114 | (files '("/var/log/guix-daemon.log")) |
| 109 | (options '("rotate 4" ;don't keep too many of them | 115 | (options `("rotate 4" ;don't keep too many of them |
| 110 | "storefile @FILENAME.@COMP_EXT"))))) | 116 | ,@%default-log-rotation-options))))) |
| 111 | 117 | ||
| 112 | (define (log-rotation->config rotation) | 118 | (define (log-rotation->config rotation) |
| 113 | "Return a string-valued gexp representing the rottlog configuration snippet | 119 | "Return a string-valued gexp representing the rottlog configuration snippet |
diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm index d666d6243b5..52de5ca7c0b 100644 --- a/gnu/services/cuirass.scm +++ b/gnu/services/cuirass.scm | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> | 2 | ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> |
| 3 | ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> | 3 | ;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com> | 4 | ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com> |
| 5 | ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org> | 5 | ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org> |
| 6 | ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net> | 6 | ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net> |
| @@ -305,7 +305,8 @@ | |||
| 305 | (files (list (cuirass-configuration-log-file config) | 305 | (files (list (cuirass-configuration-log-file config) |
| 306 | (cuirass-configuration-web-log-file config))) | 306 | (cuirass-configuration-web-log-file config))) |
| 307 | (frequency 'weekly) | 307 | (frequency 'weekly) |
| 308 | (options '("rotate 40"))))) ;worth keeping | 308 | (options `("rotate 40" ;worth keeping |
| 309 | ,@%default-log-rotation-options))))) | ||
| 309 | 310 | ||
| 310 | (define cuirass-service-type | 311 | (define cuirass-service-type |
| 311 | (service-type | 312 | (service-type |
