chore: reduce polling log noise across backend and nginx (#336)

This commit is contained in:
Daniel Volz
2026-02-27 00:54:21 +01:00
committed by GitHub
parent 19ba4bb7d2
commit 6b27d234d9
13 changed files with 226 additions and 28 deletions
+49
View File
@@ -6,6 +6,9 @@ server {
root /usr/share/nginx/html;
index index.html;
# Custom log format with ISO timestamps
log_format timed '$time_iso8601 $status $request_method $request_uri ($request_time s)';
# Access log control (suppressed when LOG_LEVEL is warn or higher)
access_log ${NGINX_ACCESS_LOG};
@@ -24,6 +27,52 @@ server {
try_files $uri /index.html;
}
# -------------------------------------------------------------------------
# High-frequency polling endpoints — suppress access logs at info level
# (visible at debug level via NGINX_POLLING_LOG)
# -------------------------------------------------------------------------
location = /api/doses/taken {
access_log ${NGINX_POLLING_LOG};
resolver 127.0.0.11 valid=10s ipv6=off;
set $backend_upstream ${BACKEND_URL};
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://$backend_upstream;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass_header Set-Cookie;
proxy_cookie_path / /;
}
location ~ ^/api/share/[^/]+/doses$ {
access_log ${NGINX_POLLING_LOG};
resolver 127.0.0.11 valid=10s ipv6=off;
set $backend_upstream ${BACKEND_URL};
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://$backend_upstream;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass_header Set-Cookie;
proxy_cookie_path / /;
}
location = /api/health {
access_log ${NGINX_POLLING_LOG};
resolver 127.0.0.11 valid=10s ipv6=off;
set $backend_upstream ${BACKEND_URL};
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://$backend_upstream;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass_header Set-Cookie;
proxy_cookie_path / /;
}
location /api/ {
# Use variable for runtime DNS resolution (nginx resolves at startup by default)
# Docker embedded DNS (127.0.0.11) with 10s cache