diff --git a/nixos/features/telemetry/nginx.nix b/nixos/features/telemetry/nginx.nix index c89ebd4..b2dfef2 100644 --- a/nixos/features/telemetry/nginx.nix +++ b/nixos/features/telemetry/nginx.nix @@ -6,17 +6,21 @@ group = config.services.nginx.group; settings = { namespaces = [{ - format = ''$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"''; name = "nginx"; + format = ''$http_host: $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"''; source.files = ["/var/log/nginx/access.log"]; + relabel = [ + { name = "host"; from = "http_host"; } + { name = "request"; from = "request"; } + { name = "body_bytes_sent"; from = "body_bytes_sent"; } + ]; }]; }; }; services.nginx.commonHttpConfig = '' - log_format combined2 "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\""; + log_format combined2 "$http_host: $remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\""; access_log /var/log/nginx/access.log combined2; - ''; networking.firewall.allowedTCPPorts = [ 14201 ];