Access log format

Version: istio-1.1.0-snapshot.5
GKE version: v1.11.5-gke.5

I’m trying to modify the default access log format by editing the “istio” config map. Whenever i have the custom format on, the log has the following. (Btw, I’m not doing anything fancy, I’m just passing the default format as the custom format to see if I can modify in the future)

[libprotobuf INFO src/istio/mixerclient/check_cache.cc:160] Add a new Referenced for check cache: Absence-keys: destination.port, destination.uid, source.ip, Exact-keys: context.protocol, context.reporter.kind, source.namespace, source.uid,

For example: my “istio” configmap in “istio-system” as the following for the format

accessLogFormat: ‘[%START_TIME%] %REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%%PROTOCOL% %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 %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS%’

Might be related to this issue on Github: https://github.com/istio/istio/pull/11449
Also, current bug in Envoy where if the trailing newline character “\n” is not included in the format string, access logs just don’t get written.

Thank you for the reply.

I did notice that newline character not formatting correctly. However my issue is: when I have the custom format on, I don’t even see any entry on the ingress log output besides one below

[libprotobuf INFO src/istio/mixerclient/check_cache.cc:160] Add a new Referenced for check cache: Absence-keys: destination.port, destination.uid, source.ip, Exact-keys: context.protocol, context.reporter.kind, source.namespace, source.uid,

I was able to get this log format working after manually making the change to configmap.yaml from this PR https://github.com/istio/istio/pull/11449/files:

accessLogFormat: “[%START_TIME%] %REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL% %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 %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS%\n”

I used double quotes and not single quotes and included the trailing new line character. I noticed there was a missing space between the percent signs here “PATH)%%PROTOCOL%”. Not sure if that matters

1 Like