#Problem

I want to collect all traffic log from Nginx Ingess.

#References

#Solution

Custom log format with ConfigMap following settings:

apiVersion: v1
kind: ConfigMap
metadata:
  name: ingress-nginx-controller
  labels:
    app: nginx-ingress
data:
#   log-format-escape-json: "true"
  log-format-upstream: '$http_host $http_x_forwarded_for [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$hostname" $req_id $request_time $upstream_response_time'
custom-format-log-upstream.yaml

Apply Configmap:

kubectl apply -f custom-format-log-upstream.yaml -n ingress-nginx