How to collect Access Log output by Envoy in istio 1.8.3

8/25/2021

First of all, according to Istio's Wiki, we output Access Log from Envoy.

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: gateway-access-log
  namespace: istio-system
  label:
    app: gateway-access-log
spec:
  configPatches:
  - applyTo: NETWORK_FILTER
    match:
      context: GATEWAY
      listener:
        filterChain:
          filter:
            name: "envoy.filters.network.http_connection_manager"
    patch:
      operation: MERGE
      value:
        typed_config:
          "@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
          access_log:
          - name: envoy.access_loggers.file
            typed_config:
              "@type": "type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog"
              path: /dev/stdout
              format: "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% \n"

The command to check the log is running the following command.

kubectl logs -l app=gateway-access-log -n istio-system

The next thing I want to do is to monitor this Access Log with another tool. The other tool should be an application that I have implemented myself, and I do not intend to use tools like DataDog or StackDriver directly. In other words, the goal is to implement a relay server to send acccess logs to your logging tool. The direct solution is to pipe the kubect logs command, but I think it's not a good way.

-- himenon
envoyproxy
istio
kubernetes
logging

0 Answers