Send nginx logs to journald (#583)

nginx only logs to files, so its access and error logs never reach journald or VictoriaLogs, and proxy errors (e.g. consul.service.consul 502s) can't be diagnosed from vlogs.

- add a `journald` log_format with `$host`, request time and upstream addr/status/response time
- add syslog (`unix:/dev/log`) targets estate-wide: `tag=nginx_access` for access, `tag=nginx` for errors
- add the same syslog targets to the per-vhost logs in simpleproxy, edgecache, reposync, certbot and puppetboard, keeping the existing files

Reviewed-on: #583
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #583.
This commit is contained in:
2026-11-24 21:32:06 +11:00
committed by BenVincent
parent e057ca9147
commit 89bd97048e
6 changed files with 48 additions and 8 deletions
+8 -2
View File
@@ -69,8 +69,14 @@ class certbot::nginx (
'listen_port' => $listen_port,
'server_name' => $server_names,
'use_default_location' => true,
'access_log' => "/var/log/nginx/${nginx_vhost}_access.log",
'error_log' => "/var/log/nginx/${nginx_vhost}_error.log",
'access_log' => [
"/var/log/nginx/${nginx_vhost}_access.log",
'syslog:server=unix:/dev/log,tag=nginx_access journald',
],
'error_log' => [
"/var/log/nginx/${nginx_vhost}_error.log",
'syslog:server=unix:/dev/log,tag=nginx',
],
'www_root' => "${data_root}/pub",
'autoindex' => 'on',
'ssl' => $enable_ssl,