Configuring Access Log format in GlobalConfig

EnRoute Technical Reference

GlobalConfig for Access Log format generated by Envoy

EnRoute GlobalConfig can be used to configure access log format that is output by Envoy.

The filed access_log_format can be used to specify the access logging format used by Envoy. Detailed information about command operators and format string can be found in Envoy’s Access Log Documentation

The example below shows a sample access log configuration using command operators.


---
apiVersion: enroute.saaras.io/v1
kind: GlobalConfig
metadata:
  labels:
    app: web
  name: gc-globals
  namespace: default
spec:
  name: gc-globals
  type: globalconfig_globals
  config: |
    {
      "tlsContext" : {
        "alpnProtos" : ["http/1.1"],
        "minimumTlsVersion" : "1.2"
       },
      "access_log_format" : "[%START_TIME%] ACCESSLOG \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_CODE% %RESPONSE_FLAGS% %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\"\n"
    }