Add log rotation
modules/config/os.scm
| 46 | 46 | #:use-module (gnu system locale) | |
| 47 | 47 | #:use-module (gnu system shadow) | |
| 48 | 48 | #:use-module (guix gexp) | |
| 49 | + | #:use-module (config rotation) | |
| 49 | 50 | #:export (server-services | |
| 50 | 51 | desktop-services | |
| 51 | 52 | tyreunom-os | |
… | |||
| 53 | 54 | ||
| 54 | 55 | (define (server-services host-name) | |
| 55 | 56 | (cons* | |
| 57 | + | server-rotation-service | |
| 56 | 58 | (service ntp-service-type) | |
| 57 | 59 | (service openssh-service-type | |
| 58 | 60 | (openssh-configuration | |
… | |||
| 76 | 78 | (qemu-binfmt-configuration | |
| 77 | 79 | (platforms (lookup-qemu-platforms "arm" "aarch64" "i686" "ppc")) | |
| 78 | 80 | (guix-support? #t))) | |
| 81 | + | desktop-rotation-service | |
| 79 | 82 | (modify-services %desktop-services | |
| 80 | 83 | (udev-service-type config => | |
| 81 | 84 | (udev-configuration | |
modules/config/rotation.scm unknown status 1
| 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 | |
| 26 | + | desktop-rotation-service)) | |
| 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 | |
| 52 | + | (service rottlog-service-type | |
| 53 | + | (rottlog-configuration | |
| 54 | + | (rotations | |
| 55 | + | (append | |
| 56 | + | (list | |
| 57 | + | (log-rotation | |
| 58 | + | (files '("/var/log/letsencrypt/letsencrypt.log")) | |
| 59 | + | (frequency 'daily) | |
| 60 | + | (options '("rotate 30" "log_rotate" "nocompress"))) | |
| 61 | + | (log-rotation | |
| 62 | + | (files '("/var/log/maillog")) | |
| 63 | + | (options '("rotate 5" "log_rotate")) | |
| 64 | + | (frequency 'daily)) | |
| 65 | + | (log-rotation | |
| 66 | + | (files '("/var/log/nginx/access.log" "/var/log/nginx/error.log")) | |
| 67 | + | (frequency 'weekly) | |
| 68 | + | (options '("rotate 1" "log_rotate" "nocompress")))) | |
| 69 | + | base-rotations))))) | |
| 70 | + | ||
| 71 | + | (define desktop-rotation-service | |
| 72 | + | (service rottlog-service-type | |
| 73 | + | (rottlog-configuration | |
| 74 | + | (rotations base-rotations)))) |