How can Istio/Envoy be configured to keep writing access logs (ingress) to files in a persistent volume?Different pods responding to a same hostname (example.com) would be writen to the same file. I think it would be something defined in Gateway YAML file or VirtualService YAML file.
This can be achieved by combination of settings up the EnvoyFilter
configuration to selectively enable access logs at gateways and use custom-bootstrap-config
:
First you would need to setup custom bootstrap configuration that will container your user-volumes
and volume mounts
. This config later on can be applied with kubectl patch
as described here.
References: https://github.com/istio/istio/issues/28302
The next step would to use EnvoyFilter
configuration to selectively enable access logs at gateways as described in [Tracing and Access Log](Use EnvoyFilter configuration to selectively enable access logs at gateways). By default logs are directed to /dev/stdout
. This has to be change appropriately to match the volume you configured in the step 1 with custom bootstrap config.
References: https://github.com/istio/istio/wiki/EnvoyFilter-Samples#tracing-and-access-logging