Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnvoyFilter [ lua filter ] is not printing log on console #11592

Closed
ajoysinha opened this issue Jun 15, 2020 · 8 comments
Closed

EnvoyFilter [ lua filter ] is not printing log on console #11592

ajoysinha opened this issue Jun 15, 2020 · 8 comments
Labels
question Questions that are neither investigations, bugs, nor enhancements stale stalebot believes this issue/PR has not been touched recently

Comments

@ajoysinha
Copy link

This is not an issue but a question.

I am new in this field. Trying to implement lua filter with OPA [ open policy agent and istio ]
to implement a simple poc, i have created following following filter.

 ############################################################
# 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
---

When i am executing my api I am able to get the updated header value in output. [ seems lua filter is invoked in filter chain ]

but my problem is, i am not able to find the log “envoy_on_request” anywhere in the container logs.

need you suggestion to find the log…

Am i missing something to enable log ..

@dio dio added the question Questions that are neither investigations, bugs, nor enhancements label Jun 15, 2020
@htuch
Copy link
Member

htuch commented Jun 15, 2020

What log level do you have configured?

@ajoysinha
Copy link
Author

I haven't specifically configure any log level, [ I also don't have idea where to set :) ] but did try to log with Error / Debug / Info all .. it didn't log for any one.

@htuch
Copy link
Member

htuch commented Jun 16, 2020

Do you have the same problem if you try this with standalone Envoy and console logs (which can be controlled with -l <loglevel>, rather than when integrated with Istio?

@ajoysinha
Copy link
Author

Thanks .. Fortunately I have found that only request_handle:logCritical is writing on log. not the other ones .. i am sure that this is standard logging configuration, but i don't have any clue how to do it..

@stale
Copy link

stale bot commented Jul 18, 2020

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions.

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Jul 18, 2020
@stale
Copy link

stale bot commented Jul 25, 2020

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted". Thank you for your contributions.

@stale stale bot closed this as completed Jul 25, 2020
@bsarvan
Copy link

bsarvan commented Jun 23, 2022

This could be due to logging level not set right for the proxy. For lua, it is required to enable debugging for Lua scripts in the IstioOperator custom resource. Below command using istioctl enables debug, info level logging for lua scripts

istioctl proxy-config log . --level lua:info

Options for --level are lua:debug, lua:info, lua:warning. Hope this helps

@xixiangzouyibian
Copy link

This could be due to logging level not set right for the proxy. For lua, it is required to enable debugging for Lua scripts in the IstioOperator custom resource. Below command using istioctl enables debug, info level logging for lua scripts

istioctl proxy-config log . --level lua:info

Options for --level are lua:debug, lua:info, lua:warning. Hope this helps

This really save my life !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions that are neither investigations, bugs, nor enhancements stale stalebot believes this issue/PR has not been touched recently
Projects
None yet
Development

No branches or pull requests

5 participants