You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/11/29 03:25:01 UTC

[GitHub] [apisix] ZChengjin opened a new issue, #8418: help request: http-logger include_resp_body does not take effect

ZChengjin opened a new issue, #8418:
URL: https://github.com/apache/apisix/issues/8418

   ### Description
   
   ### my plugin configuration
   `  "plugins": {
       "ext-plugin-pre-req": {
         "conf": [
           {
             "name": "auc",
             "value": "{\"env\":\"sandbox\",\"system\":\"admin_backend\"}"
           }
         ],
         "disable": false
       },
       "http-logger": {
         "disable": false,
         "include_req_body": true,
         "include_resp_body": true,
         "include_resp_body_expr": [
           [
             "sent_http_content_length",
             "<",
             "4096"
           ]
         ],
         "uri": "http://192.168.67.171:8082/api/v1/visitorLogin"
       }
     }`
   
   ### my log_format
   `curl http://127.0.0.1:9180/apisix/admin/plugin_metadata/http-logger \
   -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "log_format": {
           "host": "$host",
           "@timestamp": "$time_iso8601",
           "client_ip": "$remote_addr",
           "route_name": "$route_name",
           "service_name": "$service_name",
       }
   }'`
   
   ### issues
   
   My server can receive several fields in log_format, but there is no resp_bod and req_body. Is my log_format wrong? How to configure log_format?
   
   ### Environment
   
   APISIX version (run apisix version):3.0.0
   Operating system (run uname -a):Linux eee3e01b5631 4.19.76-linuxkit change: added doc of how to load plugin. #1 SMP Tue May 26 11:42:35 UTC 2020 x86_64 GNU/Linux
   OpenResty / Nginx version (run openresty -V or nginx -V):nginx version: openresty/1.21.4.1;built by gcc 10.2.1 20210110 (Debian 10.2.1-6);built with OpenSSL 1.1.1n 15 Mar 2022
   etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
   APISIX Dashboard version, if relevant:apache/apisix-dashboard:2.13-alpine
   Plugin runner version, for issues related to plugin runners:apisix-go-plugin-runner(master)
   LuaRocks version, for installation issues (run luarocks --version):


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] kingluo commented on issue #8418: help request: http-logger include_resp_body does not take effect

Posted by GitBox <gi...@apache.org>.
kingluo commented on issue #8418:
URL: https://github.com/apache/apisix/issues/8418#issuecomment-1330174093

   @ZChengjin if you set `log_format`, then it would ignore `include_req_body` and `include_resp_body`.
   And currently, APISIX has no built-in variable to provide the response body. But for the request body, a workaround may be to use nginx variable `$request_body` in your log format, but if the body is larger than 8kB (APISIX setting), then it doesn't work.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] help request: http-logger include_resp_body does not take effect [apisix]

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 closed issue #8418: help request: http-logger include_resp_body does not take effect
URL: https://github.com/apache/apisix/issues/8418


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] help request: http-logger include_resp_body does not take effect [apisix]

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8418:
URL: https://github.com/apache/apisix/issues/8418#issuecomment-1821982461

   Considered resolved


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] kingluo commented on issue #8418: help request: http-logger include_resp_body does not take effect

Posted by GitBox <gi...@apache.org>.
kingluo commented on issue #8418:
URL: https://github.com/apache/apisix/issues/8418#issuecomment-1330426991

   Yes, here are some useful references:
   https://github.com/apache/apisix/blob/master/t/plugin/http-logger-log-format.t#L491
   https://github.dev/apache/apisix/blob/master/apisix/utils/log-util.lua#L255
   
   You could register variables via the serverless plugin.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] ZChengjin commented on issue #8418: help request: http-logger include_resp_body does not take effect

Posted by GitBox <gi...@apache.org>.
ZChengjin commented on issue #8418:
URL: https://github.com/apache/apisix/issues/8418#issuecomment-1330380621

   > @ZChengjin if you set `log_format`, then it would ignore `include_req_body` and `include_resp_body`. And currently, APISIX has no built-in variable to provide the response body. But for the request body, a workaround may be to use nginx variable `$request_body` in your log format, but if the body is larger than 8kB (APISIX setting), then it doesn't work.
   
   As you said, I got the request  body,it is meaned that i can get response body by registering myown variable?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] help request: http-logger include_resp_body does not take effect [apisix]

Posted by "kayx23 (via GitHub)" <gi...@apache.org>.
kayx23 commented on issue #8418:
URL: https://github.com/apache/apisix/issues/8418#issuecomment-1821937176

   > if you set `log_format`, then it would ignore `include_req_body` and `include_resp_body`.
   > And currently, APISIX has no built-in variable to provide the response body. But for the request body, a workaround may be to use nginx variable `$request_body` in your log format, but if the body is larger than 8kB (APISIX setting), then it doesn't work.
   
   I have came across this information when when working on the logger [new doc](https://docs.api7.ai/hub/kafka-logger#log-request-bodies-conditionally) and added the following information:
   
   ![image](https://github.com/apache/apisix/assets/39619599/1cda78fc-09f2-4fd7-8106-4c718a6f7fab)
   
   As this issue is going stale, @monkeyDluffy6017 @shreemaan-abhishek please help evaluate if this should remain open.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] help request: http-logger include_resp_body does not take effect [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #8418:
URL: https://github.com/apache/apisix/issues/8418#issuecomment-1814134123

   This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org