From 0402fd2611554ed0b762a31e9b4b21c306693332 Mon Sep 17 00:00:00 2001 From: Shimon Cohen <33935191+shimoncohen@users.noreply.github.com> Date: Mon, 30 Mar 2026 15:19:18 +0300 Subject: [PATCH 1/2] chore: update log format configuration --- helm/config/log_format.conf | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/helm/config/log_format.conf b/helm/config/log_format.conf index bf44a2f..4fd71c6 100644 --- a/helm/config/log_format.conf +++ b/helm/config/log_format.conf @@ -2,43 +2,54 @@ map $msec $nanosec { ~(.*)\.(.*) $1$2000000; } -log_format json escape=json +log_format main escape=json '{' - '"Timestamp":"$nanosec",' + '"Timestamp":$nanosec,' '"Attributes":{' '"mapcolonies.time_local":"$time_local",' + {{ if .Values.authorization.enabled }} '"mapcolonies.http.auth.token.client_name":"$jwt_payload_sub",' + {{ end }} '"http.request.method":"$request_method",' + '"http.request.header.host":"$host",' '"http.request.header.referer":"$http_referer",' + '"http.request.header.content-type":"$content_type",' '"http.request.body.size":"$content_length",' - '"http.response.body.size":"$body_bytes_sent",' + '"http.request.size": $request_length,' + '"http.response.body.size": $body_bytes_sent,' '"http.response.header.x_forwarded_for":"$proxy_add_x_forwarded_for",' '"http.response.status_code":"$status",' '"user_agent.original":"$http_user_agent",' - '"network.protocol":"$server_protocol",' + '"network.protocol.name":"$otel_network_protocol_name",' + '"network.protocol.version":"$otel_network_protocol_version",' '"mapcolonies.request_time":"$request_time",' - '"mapcolonies.http.upstream_connect_time":"$upstream_connect_time",' - '"mapcolonies.http.upstream_response_time":"$upstream_response_time",' '"mapcolonies.http.upstream_addr":"$upstream_addr",' '"mapcolonies.http.upstream_status_code":"$upstream_status",' + '"mapcolonies.http.upstream_connect_time":"$upstream_connect_time",' + '"mapcolonies.http.upstream_response_time":"$upstream_response_time",' + '"mapcolonies.http.upstream_response_length":"$upstream_response_length",' + '"mapcolonies.http.upstream_bytes_sent": $upstream_bytes_sent,' + '"mapcolonies.http.upstream_bytes_received": $upstream_bytes_received,' '"mapcolonies.http.upstream_cache_status":"$upstream_cache_status",' - '"mapcolonies.server":"$hostname",' '"server.address":"$host",' '"server.port":"$server_port",' '"client.address":"$remote_addr",' '"client.port":"$remote_port",' '"url.scheme":"$scheme",' '"url.path":"$uri",' - '"url.full":"$request_uri"' + '"url.full":"$request_uri",' + '"url.query":"$query_string"' '},' '"Resource":{' + # Additional important log details should be added here + '"host.name":"$hostname",' '"service.name":"{{ .Values.image.repository }}",' '"service.version":"{{ .Values.image.tag }}"' '},' '"TraceId":"$otel_trace_id",' ## this is a byte sequence (hex-encoded in JSON) '"SpanId":"$otel_span_id",' '"SeverityText":"INFO",' - '"SeverityNumber":"9",' + '"SeverityNumber": 9,' '"InstrumentationScope":"access.log",' '"Body":"$request"' '}'; From da2adb7295ea34941763f0daf32fa4e4f31cdb56 Mon Sep 17 00:00:00 2001 From: shimoncohen Date: Mon, 30 Mar 2026 17:39:35 +0300 Subject: [PATCH 2/2] chore(nginx): upgrade nginx chart version --- helm/Chart.lock | 6 ++-- helm/Chart.yaml | 2 +- helm/config/log_format.conf | 55 ----------------------------- helm/config/nginx.conf | 41 --------------------- helm/templates/nginx-configmap.yaml | 2 -- helm/values.yaml | 6 ---- 6 files changed, 4 insertions(+), 108 deletions(-) delete mode 100644 helm/config/log_format.conf delete mode 100644 helm/config/nginx.conf diff --git a/helm/Chart.lock b/helm/Chart.lock index 7e66de4..344ccf1 100644 --- a/helm/Chart.lock +++ b/helm/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: nginx repository: oci://acrarolibotnonprod.azurecr.io/helm/common - version: 2.1.0 -digest: sha256:18e8ad9d643309745bcdd30df03b0e01ec004d295ce2d5a7a81fc8c40e0e9206 -generated: "2025-09-02T12:36:32.560619638+03:00" + version: 2.1.2 +digest: sha256:83c525d0b74b939863f38f4a6716d1e7a3b1b955433cda7ee0e36f1af473d798 +generated: "2026-03-30T12:20:07.932221448+03:00" diff --git a/helm/Chart.yaml b/helm/Chart.yaml index cadbb9c..f30f670 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -6,5 +6,5 @@ version: 2.2.0 appVersion: 2.2.0 dependencies: - name: nginx - version: 2.1.0 + version: 2.1.2 repository: oci://acrarolibotnonprod.azurecr.io/helm/common diff --git a/helm/config/log_format.conf b/helm/config/log_format.conf deleted file mode 100644 index 4fd71c6..0000000 --- a/helm/config/log_format.conf +++ /dev/null @@ -1,55 +0,0 @@ -map $msec $nanosec { - ~(.*)\.(.*) $1$2000000; -} - -log_format main escape=json -'{' - '"Timestamp":$nanosec,' - '"Attributes":{' - '"mapcolonies.time_local":"$time_local",' - {{ if .Values.authorization.enabled }} - '"mapcolonies.http.auth.token.client_name":"$jwt_payload_sub",' - {{ end }} - '"http.request.method":"$request_method",' - '"http.request.header.host":"$host",' - '"http.request.header.referer":"$http_referer",' - '"http.request.header.content-type":"$content_type",' - '"http.request.body.size":"$content_length",' - '"http.request.size": $request_length,' - '"http.response.body.size": $body_bytes_sent,' - '"http.response.header.x_forwarded_for":"$proxy_add_x_forwarded_for",' - '"http.response.status_code":"$status",' - '"user_agent.original":"$http_user_agent",' - '"network.protocol.name":"$otel_network_protocol_name",' - '"network.protocol.version":"$otel_network_protocol_version",' - '"mapcolonies.request_time":"$request_time",' - '"mapcolonies.http.upstream_addr":"$upstream_addr",' - '"mapcolonies.http.upstream_status_code":"$upstream_status",' - '"mapcolonies.http.upstream_connect_time":"$upstream_connect_time",' - '"mapcolonies.http.upstream_response_time":"$upstream_response_time",' - '"mapcolonies.http.upstream_response_length":"$upstream_response_length",' - '"mapcolonies.http.upstream_bytes_sent": $upstream_bytes_sent,' - '"mapcolonies.http.upstream_bytes_received": $upstream_bytes_received,' - '"mapcolonies.http.upstream_cache_status":"$upstream_cache_status",' - '"server.address":"$host",' - '"server.port":"$server_port",' - '"client.address":"$remote_addr",' - '"client.port":"$remote_port",' - '"url.scheme":"$scheme",' - '"url.path":"$uri",' - '"url.full":"$request_uri",' - '"url.query":"$query_string"' - '},' - '"Resource":{' - # Additional important log details should be added here - '"host.name":"$hostname",' - '"service.name":"{{ .Values.image.repository }}",' - '"service.version":"{{ .Values.image.tag }}"' - '},' - '"TraceId":"$otel_trace_id",' ## this is a byte sequence (hex-encoded in JSON) - '"SpanId":"$otel_span_id",' - '"SeverityText":"INFO",' - '"SeverityNumber": 9,' - '"InstrumentationScope":"access.log",' - '"Body":"$request"' -'}'; diff --git a/helm/config/nginx.conf b/helm/config/nginx.conf deleted file mode 100644 index 6651bac..0000000 --- a/helm/config/nginx.conf +++ /dev/null @@ -1,41 +0,0 @@ -#user nginx; -load_module modules/ngx_http_js_module.so; -load_module modules/ngx_otel_module.so; -worker_processes 4; - -error_log /var/log/nginx/error.log warn; -pid /tmp/nginx.pid; - -events { - worker_connections 1024; -} - -http { - otel_service_name {{ .Values.nginx.opentelemetry.serviceName }}; - otel_exporter { - endpoint {{ .Values.nginx.opentelemetry.exporterHost }}:{{ .Values.nginx.opentelemetry.exporterPort }}; - } - - include /etc/nginx/mime.types; - default_type application/octet-stream; - - {{ if .Values.nginx.authorization.enabled }} - js_import auth from /etc/nginx/auth.js; - js_set $jwt_payload_sub auth.jwtPayloadSub; - - js_var $opa_result; - js_var $opa_reason; - {{ end }} - - include /etc/nginx/log_format.conf; - access_log /var/log/nginx/access.log json; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - #gzip on; - - include /etc/nginx/conf.d/*.conf; -} diff --git a/helm/templates/nginx-configmap.yaml b/helm/templates/nginx-configmap.yaml index 315bc2d..66cab39 100644 --- a/helm/templates/nginx-configmap.yaml +++ b/helm/templates/nginx-configmap.yaml @@ -10,7 +10,5 @@ metadata: environment: {{ include "heights.environment" . }} release: {{ .Release.Name }} data: - log_format.conf: {{ tpl (.Files.Get "config/log_format.conf") . | quote }} default.conf: {{ tpl (.Files.Get "config/default.conf") . | quote }} - nginx.conf: {{ tpl (.Files.Get "config/nginx.conf") . | quote }} {{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index a0e5d8b..bba45ad 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -100,12 +100,6 @@ nginx: - name: nginx-config mountPath: "/etc/nginx/conf.d/default.conf" subPath: default.conf - - name: nginx-config - mountPath: "/etc/nginx/nginx.conf" - subPath: nginx.conf - - name: nginx-config - mountPath: "/etc/nginx/log_format.conf" - subPath: log_format.conf resources: enabled: true value: