EnvoyFilter [ lua filter ]未在控制台打印日志

我是这个领域的新手。试图与 OPA [ open policy agent 和 istio ] 一起实现 lua 过滤器

为了实现一个简单的 poc,我创建了以下过滤器

 ############################################################
# Envoy External Authorization filter that will query OPA.
############################################################
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: ext-authz
  namespace: istio-system
spec:
  filters:
  - insertPosition:
      index: FIRST
    listenerMatch:
      listenerType: GATEWAY
      listenerProtocol: HTTP
    filterType: HTTP
    filterName: envoy.lua
    filterConfig:
      inlineCode: |
        function envoy_on_request(request_handle)
            request_handle:logWarn("envoy_on_request")
        end

        function envoy_on_response(response_handle)
            response_handle:logWarn("envoy_on_response")
            response_handle:headers():add("x-this","It works")
        end
---

当我执行我的 api 时,我能够在输出中获取更新的标头值。[似乎在过滤链中调用了lua过滤器]

但我的问题是,我找不到日志“envoy_on_request”的任何地方在容器日志中。

需要你的建议找到日志…

点赞
用户12533932
用户12533932

你是否检查了 istio-proxy 容器?Envoy 的日志通常可以在那里找到。

2020-06-15 15:47:13
用户14101019
用户14101019

在服务规范元数据注释中添加以下行应该会有所帮助

sidecar.istio.io/componentLogLevel: "lua:info"
2021-04-17 10:12:08