rotation.scm
| 1 | ;;; Tyreunom's system administration and configuration tools. |
| 2 | ;;; |
| 3 | ;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu> |
| 4 | ;;; |
| 5 | ;;; This program is free software: you can redistribute it and/or modify |
| 6 | ;;; it under the terms of the GNU General Public License as published by |
| 7 | ;;; the Free Software Foundation, either version 3 of the License, or |
| 8 | ;;; (at your option) any later version. |
| 9 | ;;; |
| 10 | ;;; This program is distributed in the hope that it will be useful, |
| 11 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | ;;; GNU General Public License for more details. |
| 14 | ;;; |
| 15 | ;;; You should have received a copy of the GNU General Public License |
| 16 | ;;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | ;; |
| 19 | ;; Definition of rotation policies |
| 20 | ;; |
| 21 | |
| 22 | (define-module (config rotation) |
| 23 | #:use-module (gnu services) |
| 24 | #:use-module (gnu services admin) |
| 25 | #:export (server-rotation-service-config |
| 26 | desktop-rotation-service-config)) |
| 27 | |
| 28 | (define base-rotations |
| 29 | (list |
| 30 | (log-rotation |
| 31 | ;; What about /var/log/guix? |
| 32 | (files '("/var/log/guix-daemon.log")) |
| 33 | (frequency 'daily) |
| 34 | (options '("rotate 1" "log_rotate"))) |
| 35 | (log-rotation |
| 36 | (files '("/var/log/mcron.log")) |
| 37 | (frequency 'weekly) |
| 38 | (options '("rotate 2" "log_rotate"))) |
| 39 | (log-rotation |
| 40 | (files |
| 41 | (map |
| 42 | (lambda (<>) (string-append "/var/log/" <>)) |
| 43 | '("debug" "lastlog" "messages" "secure" "wtmp"))) |
| 44 | (frequency 'weekly) |
| 45 | (options '("rotate 4" "log_rotate"))) |
| 46 | (log-rotation |
| 47 | (files '("/var/log/shepherd.log")) |
| 48 | (frequency 'daily) |
| 49 | (options '("rotate 1" "log_rotate"))))) |
| 50 | |
| 51 | (define server-rotation-service-config |
| 52 | (rottlog-configuration |
| 53 | (rotations |
| 54 | (append |
| 55 | (list |
| 56 | (log-rotation |
| 57 | (files '("/var/log/letsencrypt/letsencrypt.log")) |
| 58 | (frequency 'daily) |
| 59 | (options '("rotate 30" "log_rotate" "nocompress"))) |
| 60 | (log-rotation |
| 61 | (files '("/var/log/maillog")) |
| 62 | (options '("rotate 5" "log_rotate")) |
| 63 | (frequency 'daily)) |
| 64 | (log-rotation |
| 65 | (files '("/var/log/nginx/access.log" "/var/log/nginx/error.log")) |
| 66 | (frequency 'weekly) |
| 67 | (options '("rotate 1" "log_rotate" "nocompress")))) |
| 68 | base-rotations)))) |
| 69 | |
| 70 | (define desktop-rotation-service-config |
| 71 | (rottlog-configuration |
| 72 | (rotations base-rotations))) |
| 73 |