summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-11-16 21:20:27 -0500
committerDavid Thompson <dthompson2@worcester.edu>2023-11-16 21:20:27 -0500
commite2bcb0048fcd07d7135607eeb60236bae821c07f (patch)
treec29aa8a8a4315d4ab7b640b8c44a353528da9af3
parent544f75f1f2a0f110d3d09536b3a047e48ecfd471 (diff)
takemi: os: Attempt to rotate nginx and fcgiwrap logs.
-rw-r--r--takemi-os.scm28
1 files changed, 28 insertions, 0 deletions
diff --git a/takemi-os.scm b/takemi-os.scm
index f6c2aec..a35793d 100644
--- a/takemi-os.scm
+++ b/takemi-os.scm
@@ -1,5 +1,6 @@
(use-modules (gnu)
(gnu packages version-control)
+ (gnu services admin)
(gnu services certbot)
(gnu services cgit)
(gnu services ci)
@@ -279,6 +280,33 @@
;; repos.
(group "git")
(socket (string-append "tcp:" fcgiwrap-socket))))
+ ;; Log rotation.
+ (simple-service 'rotate-logs
+ rottlog-service-type
+ (list (log-rotation
+ (frequency 'daily)
+ (files '("/var/log/nginx/access.log"
+ "/var/log/nginx/error.log"))
+ (options `( ;; Keep a week of logs.
+ "rotate 6"
+ ;; Run post-rotate once per
+ ;; rotation rather than once
+ ;; for each file.
+ "sharedscripts"
+ ,@%default-log-rotation-options))
+ ;; Tell nginx to reopen its log files after rotation.
+ (post-rotate
+ (program-file
+ "nginx-post-rotate-hook"
+ #~(let ((pid (call-with-input-file
+ "/var/run/nginx/pid"
+ read)))
+ (kill pid SIGUSR1)))))
+ (log-rotation
+ (frequency 'daily)
+ (files '("/var/log/fcgiwrap.log"))
+ (options `("rotate 6"
+ ,@%default-log-rotation-options)))))
(modify-services %base-services
(guix-service-type config =>
(guix-configuration