diff --git a/helm/config/log_format.conf b/helm/config/log_format.conf index 0df36ed..3f8ced9 100644 --- a/helm/config/log_format.conf +++ b/helm/config/log_format.conf @@ -6,36 +6,39 @@ log_format json escape=json '{' '"Timestamp": $nanosec,' '"Attributes": {' - '"mapcolonies.time_local":"$time_local",' - {{ if and (.Values.global.opalaEnabled) (.Values.nginx.authorization.enabled) }} - '"mapcolonies.http.auth.token.client_name":"$jwt_payload_sub",' + '"mapcolonies.time_local": "$time_local",' + {{ if .Values.nginx.authorization.enabled }} + '"mapcolonies.http.auth.token.client_name": "$jwt_payload_sub",' {{ end }} - '"http.status_code": $status,' - '"http.url": "$http_referer",' - '"http.x_forwarded_for": "$http_x_forwarded_for",' - '"http.proxy_add_x_forwarded_for": "$proxy_add_x_forwarded_for",' - '"http.user_agent": "$http_user_agent",' - '"http.request_time": $request_time,' - '"request_length": "$request_length",' - '"http.host": "$host",' - '"upstream_addr": "$upstream_addr",' - '"upstream_status": "$upstream_status",' - '"upstream_connect_time": "$upstream_connect_time",' - '"upstream_header_time": "$upstream_header_time",' - '"upstream_response_time": "$upstream_response_time",' - '"upstream_response_length": "$upstream_response_length",' - '"upstream_bytes_sent": "$upstream_bytes_sent",' - '"upstream_bytes_received": "$upstream_bytes_received",' - '"upstream_http_name": "$upstream_http_name",' - '"bytes_sent": "$bytes_sent",' - '"body_bytes_sent": "$body_bytes_sent",' - '"content_type":"$content_type",' - '"content_length":"$content_length",' - '"remote_addr": "$remote_addr",' - '"remote_port": "$remote_port",' - '"remote_user": "$remote_user",' - '"connection":"$connection",' - '"cache_status":"$upstream_cache_status",' + '"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.header.content-length": "$content_length",' + '"http.request.body.size": $request_length,' + '"http.request.size": $bytes_sent,' + '"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",' + '"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_http_name": "$upstream_http_name",' + '"mapcolonies.client.user": "$remote_user",' + '"client.address": "$remote_addr",' + '"client.port": $remote_port,' + '"url.scheme": "$scheme",' + '"url.full": "$request_uri",' + '"url.path": "$uri",' + '"url.query": "$query_string".' + '"connection": "$connection",' + '"cache_status": "$upstream_cache_status",' '"connection_requests": "$connection_requests",' '"connections_active": "$connections_active",' '"connections_reading": "$connections_reading",' @@ -44,9 +47,9 @@ log_format json escape=json '"ancient_browser": "$ancient_browser",' '"modern_browser": "$modern_browser",' '"binary_remote_addr": "$binary_remote_addr",' - '"hostname": "$hostname",' + '"host.name": "$hostname",' '"http_name": "$http_name",' - '"pid": "$pid",' + '"process.pid": "$pid",' '"proxy_protocol_addr": "$proxy_protocol_addr",' '"proxy_protocol_port": "$proxy_protocol_port",' '"proxy_protocol_server_addr": "$proxy_protocol_server_addr",' @@ -56,9 +59,10 @@ log_format json escape=json '"realip_remote_addr": "$realip_remote_addr",' '"realip_remote_port": "$realip_remote_port",' '"server_name": "$server_name",' - '"server_addr ": "$server_addr ",' - '"server_port": "$server_port",' - '"server_protocol": "$server_protocol",' + '"server.address": "$server_addr",' + '"server.port": $server_port,' + '"network.protocol.name": "$otel_network_protocol_name",' + '"network.protocol.version": "$otel_network_protocol_version",' '"tcpinfo_rtt": "$tcpinfo_rtt",' '"tcpinfo_rttvar": "$tcpinfo_rttvar",' '"tcpinfo_snd_cwnd": "$tcpinfo_snd_cwnd",' @@ -74,6 +78,6 @@ log_format json escape=json {{ end }} '"SeverityText": "INFO",' '"SeverityNumber": 9,' - '"RequestBody": "$request_body",' + '"InstrumentationScope":"access.log",' '"Body": "$request"' '}'; diff --git a/helm/config/nginx.conf b/helm/config/nginx.conf index 0abbfd7..f569610 100644 --- a/helm/config/nginx.conf +++ b/helm/config/nginx.conf @@ -12,6 +12,17 @@ events { http { opentelemetry_config /otel/otel-nginx.toml; + + map $server_protocol $otel_network_protocol_name { + (.+)/.+$ $1; + default "http"; + } + + map $server_protocol $otel_network_protocol_version { + .+/(.+)$ $1; + default "1.1"; + } + include /etc/nginx/mime.types; default_type application/octet-stream;