Skip to content

Instantly share code, notes, and snippets.

@nomaster
Created January 27, 2022 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nomaster/3c56856bc270699545905fefdf5c366d to your computer and use it in GitHub Desktop.
Save nomaster/3c56856bc270699545905fefdf5c366d to your computer and use it in GitHub Desktop.
Kubernetes Nginx Ingress logfmt
resource "kubernetes_config_map" "config_map" {
name = "nginx-config"
namespace = "ingress"
data = <<EOF
log-format-upstream: >
latency=$upstream_response_time
protocol=$server_protocol
proxyAlternativeUpstreamName=$proxy_alternative_upstream_name
proxyUpstreamName=$proxy_upstream_name
referer=$http_referer
remoteIp=$remote_addr
requestID=$req_id
requestMethod=$request_method
requestSize=$request_length
requestUrl=$host$request_uri
responseSize=$upstream_response_length
status=$status
timestamp=$time_iso8601
upstreamAddr=$upstream_addr
upstreamStatus=$upstream_status
userAgent="$http_user_agent"
EOF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment