github.com/nginxinc/kubernetes-ingress@v1.12.5/examples/custom-log-format/README.md (about)

     1  # Custom NGINX log format
     2  
     3  This example lets you set the log-format for NGINX using the configmap resource
     4  
     5  ```yaml 
     6  kind: ConfigMap
     7  apiVersion: v1
     8  metadata:
     9    name: nginx-config
    10    namespace: nginx-ingress
    11  data:
    12    log-format:  '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer"  "$http_user_agent" "$http_x_forwarded_for" "$resource_name" "$resource_type" "$resource_namespace" "$service"'
    13  ```
    14  
    15  In addition to the [built-in NGINX variables](https://nginx.org/en/docs/varindex.html), you can also use the variables that the Ingress Controller configures:
    16  - $resource_type - The type of kubernetes resource that handled the client request.
    17  - $resource_name - The name of the resource
    18  - $resource_namespace - The namespace the resource exists in.
    19  - $service - The name of the service the client request was sent to.
    20  
    21  **note** These variables are only available for Ingress, VirtualServer and VirtualServerRoute resources.