mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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.
This commit is contained in:
parent
4e2e5c71cb
commit
825d3baa87
1 changed files with 16 additions and 2 deletions
|
@ -765,6 +765,14 @@ of index files."
|
||||||
(cons head out)))
|
(cons head out)))
|
||||||
(fold-right flatten1 '() lst))
|
(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)
|
(define (default-nginx-config config)
|
||||||
(match-record config
|
(match-record config
|
||||||
<nginx-configuration>
|
<nginx-configuration>
|
||||||
|
@ -782,7 +790,7 @@ of index files."
|
||||||
(flatten
|
(flatten
|
||||||
"user nginx nginx;\n"
|
"user nginx nginx;\n"
|
||||||
"pid " run-directory "/pid;\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-load-module modules)
|
||||||
(map emit-global-directive global-directives)
|
(map emit-global-directive global-directives)
|
||||||
"http {\n"
|
"http {\n"
|
||||||
|
@ -792,7 +800,7 @@ of index files."
|
||||||
" uwsgi_temp_path " run-directory "/uwsgi_temp;\n"
|
" uwsgi_temp_path " run-directory "/uwsgi_temp;\n"
|
||||||
" scgi_temp_path " run-directory "/scgi_temp;\n"
|
" scgi_temp_path " run-directory "/scgi_temp;\n"
|
||||||
(map emit-nginx-log-format-config log-formats)
|
(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"
|
" include " nginx "/share/nginx/conf/mime.types;\n"
|
||||||
(if lua-package-path
|
(if lua-package-path
|
||||||
#~(format #f " lua_package_path ~s;~%"
|
#~(format #f " lua_package_path ~s;~%"
|
||||||
|
@ -916,11 +924,17 @@ renewed TLS certificates, or @code{include}d files.")
|
||||||
(documentation "Re-open log files.")
|
(documentation "Re-open log files.")
|
||||||
(procedure (nginx-action "-p" run-directory "-s" "reopen"))))))))))
|
(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
|
(define nginx-service-type
|
||||||
(service-type (name 'nginx)
|
(service-type (name 'nginx)
|
||||||
(extensions
|
(extensions
|
||||||
(list (service-extension shepherd-root-service-type
|
(list (service-extension shepherd-root-service-type
|
||||||
nginx-shepherd-service)
|
nginx-shepherd-service)
|
||||||
|
(service-extension log-rotation-service-type
|
||||||
|
nginx-log-files)
|
||||||
(service-extension activation-service-type
|
(service-extension activation-service-type
|
||||||
nginx-activation)
|
nginx-activation)
|
||||||
(service-extension account-service-type
|
(service-extension account-service-type
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue