This is an automated email from the git hooks/post-receive script.
guix_mirror_bot pushed a commit to branch master
in repository guix.
The following commit(s) were added to refs/heads/master by this push:
new 825d3baa87 services: nginx: Rotate log files.
825d3baa87 is described below
commit 825d3baa87e8c35f423d4a29757688435840c8e3
Author: Arun Isaac <[email protected]>
AuthorDate: Tue Aug 5 23:38:52 2025 +0100
services: nginx: Rotate log files.
* gnu/services/web.scm (nginx-access-log-file, nginx-error-log-file,
nginx-log-files): New functions.
(nginx-service-type): Extend log-rotation-service-type.
---
gnu/services/web.scm | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 9caa03317b..d08122353f 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -765,6 +765,14 @@ of index files."
(cons head out)))
(fold-right flatten1 '() lst))
+(define (nginx-access-log-file config)
+ (string-append (nginx-configuration-log-directory config)
+ "/access.log"))
+
+(define (nginx-error-log-file config)
+ (string-append (nginx-configuration-log-directory config)
+ "/error.log"))
+
(define (default-nginx-config config)
(match-record config
<nginx-configuration>
@@ -782,7 +790,7 @@ of index files."
(flatten
"user nginx nginx;\n"
"pid " run-directory "/pid;\n"
- "error_log " log-directory "/error.log " (symbol->string log-level)
";\n"
+ "error_log " (nginx-error-log-file config) " " (symbol->string
log-level) ";\n"
(map emit-load-module modules)
(map emit-global-directive global-directives)
"http {\n"
@@ -792,7 +800,7 @@ of index files."
" uwsgi_temp_path " run-directory "/uwsgi_temp;\n"
" scgi_temp_path " run-directory "/scgi_temp;\n"
(map emit-nginx-log-format-config log-formats)
- " access_log " log-directory "/access.log " (symbol->string
log-format) ";\n"
+ " access_log " (nginx-access-log-file config) " "
(symbol->string log-format) ";\n"
" include " nginx "/share/nginx/conf/mime.types;\n"
(if lua-package-path
#~(format #f " lua_package_path ~s;~%"
@@ -916,11 +924,17 @@ renewed TLS certificates, or @code{include}d files.")
(documentation "Re-open log files.")
(procedure (nginx-action "-p" run-directory "-s"
"reopen"))))))))))
+(define (nginx-log-files config)
+ (list (nginx-access-log-file config)
+ (nginx-error-log-file config)))
+
(define nginx-service-type
(service-type (name 'nginx)
(extensions
(list (service-extension shepherd-root-service-type
nginx-shepherd-service)
+ (service-extension log-rotation-service-type
+ nginx-log-files)
(service-extension activation-service-type
nginx-activation)
(service-extension account-service-type