I'd like to log request and response body from incoming traffic to each my microservice. Is it possible in Istio (Envoy) out-of-the-box? I don't see body attribute for mapping in Mixer's EntryLog. Maybe it will be added in future version of Istio?
Of course I can achieve this by implementing my own filter in microservise, but maybe there is better solution to achieve this.
Envoy logging By default Envoy system logs are sent to /dev/stderr . This can be overridden using --log-path . Envoy on a Windows system Envoy will output to CON by default. This can also be used as a logging path when configuring logging.
Istio uses an extended version of the Envoy proxy. Envoy is a high-performance proxy developed in C++ to mediate all inbound and outbound traffic for all services in the service mesh. Envoy proxies are the only Istio components that interact with data plane traffic.
If I understand your question correctly, then you should check out this documentation of Lua filters. https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/lua_filter https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/lua_filter#script-examples
body = handle:body() should give you the request or response body, depending upon the handle.
handle:logInfo(message) should help you log it.
For me print statement also had worked. e.g. print(headers["Cache-Control"]) was putting the header value in the log of my app on GCP project's kubernetes cluster.
You need to apply an EnvoyFilter in your kubernetes cluster and in the lua code, you can log the request body. Also keep in mind that 'The filter should be configured with the name envoy.lua' ONLY
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With