You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "281743556 (via GitHub)" <gi...@apache.org> on 2023/07/17 10:35:21 UTC

[GitHub] [apisix] 281743556 opened a new issue, #9854: bug: rocketmq-logger reseponse body decode fail

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

   ### Current Behavior
   
   版本:2.13.3
   在开启rocketmq-logger插件后,响应body接收乱码
   配置如下
   ```json
   {
     "disable": false,
     "include_resp_body": true,
     "nameserver_list": [
       "127.0.0.1:9876"
     ],
     "topic": "getaway-log"
   }
   ```
   在rocketmq-dashboard看到消息体:
   ```json
   "response":{
     "body":"\u001f�\b\u0000\u0000\u0000\u0000\u0000\u0000�\u0004�[\n�0\f\u0000���[$}\u0011�\u001az�4��\u000f�X�ʲwߙ\/���2�M\u000f\u0018��\u0011%�[A牑SG��\u0006\t\t]���y3�_�\u0013۽�RӍ�\u000b\rh=�KG�|�\u0005\u0006���?\u0000\u0000\u0000��\u0003\u0000Ӣ\u0004\u000b^\u0000\u0000\u0000",
     "status":200,
     "size":713
   }
   ```
   
   
   
   ### Expected Behavior
   
   实际body参数
   ``` json
   {
       "accessToken": "xxxx",
       "expireSeconds": 7200
   }
   ```
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   1、开启全局插件 rocketmq-logger
   2、调用route接口
   3、查看rocketmq-dashboard控制台,查看message
   
   ### Environment
   
   - APISIX version (run `apisix version`): 2.13.3
   - Operating system (run `uname -a`): root
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): openresty/1.21.4.1
   - LuaRocks version, for installation issues (run `luarocks --version`): none
   


-- 
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] 281743556 commented on issue #9854: bug: rocketmq-logger reseponse body decode fail

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

   > [Jul 20, 2023](#event-9868910019)
   body include Chinese :not
   response has been compress ? not base64 or not gzip,client response receive ok,but rocketmq garbled characters


-- 
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] Sn0rt commented on issue #9854: bug: rocketmq-logger reseponse body decode fail

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

   take a look


-- 
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] github-actions[bot] commented on issue #9854: bug: rocketmq-logger reseponse body decode fail

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

   This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.


-- 
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] github-actions[bot] commented on issue #9854: bug: rocketmq-logger reseponse body decode fail

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

   Due to lack of the reporter's response this issue has been labeled with "no response". It will be close in 3 days 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


[GitHub] [apisix] github-actions[bot] closed issue #9854: bug: rocketmq-logger reseponse body decode fail

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #9854: bug: rocketmq-logger reseponse body decode fail
URL: https://github.com/apache/apisix/issues/9854


-- 
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] Sn0rt commented on issue #9854: bug: rocketmq-logger reseponse body decode fail

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

   can you share the reproduce step ? 
   


-- 
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] shreemaan-abhishek commented on issue #9854: bug: rocketmq-logger reseponse body decode fail

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

   # Translation:
    ### Current Behavior
   
   Version: 2.13.3
   After enabling the rocketmq-logger plug-in, the response body receives garbled characters
   The configuration is as follows
    
    ```json
    {
      "disable": false,
      "include_resp_body": true,
      "nameserver_list": [
        "127.0.0.1:9876"
      ],
      "topic": "getaway-log"
    }
    ```
    
   See the message body on rocketmq-dashboard:
    
    ```json
    "response":{
      "body":"\u001f�\b\u0000\u0000\u0000\u0000\u0000\u0000�\u0004�[\n�0\f\u0000���[$}\u0011�\u001az�4��\u000f�X�ʲwߙ\/���2�M\u000f\u0018��\u0011%�[A牑SG��\u0006\t\t]���y3�_�\u0013۽�RӍ�\u000b\rh=�KG�|�\u0005\u0006���?\u0000\u0000\u0000��\u0003\u0000Ӣ\u0004\u000b^\u0000\u0000\u0000",
      "status":200,
      "size":713
    }
    ```
    
    ### Expected Behavior
   Actual body parameters
    
    ```json
    {
        "accessToken": "xxxx",
        "expireSeconds": 7200
    }
    ```
    
    ### Error Logs
    _No response_
    
    ### Steps to Reproduce
   1. Open the global plug-in rocketmq-logger
   2. Call the route interface
   3. View the rocketmq-dashboard console and view the message
    
    ### Environment
    * APISIX version (run `apisix version`): 2.13.3
    * Operating system (run `uname -a`): root
    * OpenResty / Nginx version (run `openresty -V` or `nginx -V`): openresty/1.21.4.1
    * LuaRocks version, for installation issues (run `luarocks --version`): none
   
   


-- 
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] Sn0rt commented on issue #9854: bug: rocketmq-logger reseponse body decode fail

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

   I don't have any java technology stack background, I try to help you solve this problem.
   
   so my question as follow
   
   1. how to reproduce this issues without rocketmq-dashboard ? this dashbaord looks doesn’t work.
   2. how to query the log entire which pushed by APISIX logger plugin by cmdline ?
   
   # install rocketmq
   
   ## install rockettmq
   
   install rockettmq at ubuntu server, the ip address is `192.168.31.191`
   
   ```bash
   wget https://dist.apache.org/repos/dist/release/rocketmq/5.1.3/rocketmq-all-5.1.3-source-release.zip
   unzip rocketmq-all-5.1.3-source-release.zip
   cd rocketmq-all-5.1.3-source-release/
   mvn -Prelease-all -DskipTests -Dspotbugs.skip=true clean install -U
   cd distribution/target/rocketmq-5.1.3/rocketmq-5.1.3
   
   # Start NameServer
   nohup sh bin/mqnamesrv &
   
   # Start Broker and Proxy
   nohup sh bin/mqbroker -n localhost:9876 --enable-proxy &
   
   # Send and Receive Messages with tools
   export NAMESRV_ADDR=localhost:9876
   sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer
   sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer
   ```
   
   update the `bin/runserver.sh`
   
   ```bash
   JAVA_OPT="${JAVA_OPT} --add-exports=java.base/sun.nio.ch=ALL-UNNAMED"
   ```
   
   ## install rocketmq-dashboard
   
    rocketmq-dashboard at macos , which is my develop machine
   
   ```bash
   docker pull apacherocketmq/rocketmq-dashboard:latest
   docker run -d --name rocketmq-dashboard -e "JAVA_OPTS=-Drocketmq.namesrv.addr=192.168.31.191:9876" -p 8080:8080 -t apacherocketmq/rocketmq-dashboard:latest
   ```
   
   ## ensure it’s work
   
   1. connect to the ubuntu server 9876 port is ok.
   
   ```bash
   ~> telnet 192.168.31.191 9876
   Trying 192.168.31.191...
   Connected to 192.168.31.191.
   Escape character is '^]'.
   ^]
   telnet> q
   Connection closed.
   ```
   
   1. and the dashboard looks doesn’t work. with error info 
   
   ![image](https://github.com/apache/apisix/assets/2706161/42fb4cfc-0e5f-465b-ac97-79c1f69bd414)
   
   
   # setting rocketmq-logger plugin
   
   1. set the log format
   
   ```bash
   curl http://127.0.0.1:9180/apisix/admin/plugin_metadata/rocketmq-logger -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "log_format": {
           "host": "$host",
           "@timestamp": "$time_iso8601",
           "client_ip": "$remote_addr"
       }
   }'
   ```
   
   1. bind the rocketmq-logger to a router.
   
   ```bash
   curl http://127.0.0.1:9180/apisix/admin/routes/5 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
      {
        "plugins": {
          "rocketmq-logger": {
            "disable": false,
            "include_resp_body": true,
            "nameserver_list": [
              "192.168.31.191:9876"
            ],
            "topic": "getaway-log"
          }
        },
        "upstream": {
          "nodes": {
            "httpbin.org": 1
          },
          "type": "roundrobin"
        },
        "uri": "/*"
      }'
   
   {"key":"/apisix/routes/5","value":{"plugins":{"rocketmq-logger":{"buffer_duration":60,"include_resp_body":true,"meta_format":"default","nameserver_list":["192.168.31.191:9876"],"name":"rocketmq logger","use_tls":false,"access_key":"","secret_key":"","timeout":3,"disable":false,"include_req_body":false,"batch_max_size":1000,"inactive_timeout":5,"topic":"getaway-log","max_retry_count":0,"retry_delay":1}},"upstream":{"nodes":{"httpbin.org":1},"hash_on":"vars","type":"roundrobin","scheme":"http","pass_host":"pass"},"status":1,"priority":0,"uri":"/*","id":"5","update_time":1690801708,"create_time":1690785544}}
   ```
   
   1. trigger the router.
   
   ```bash
   curl -i http://127.0.0.1:9080/anything
   HTTP/1.1 200 OK
   Content-Type: application/json
   Content-Length: 388
   Connection: keep-alive
   Date: Mon, 31 Jul 2023 11:09:32 GMT
   Access-Control-Allow-Origin: *
   Access-Control-Allow-Credentials: true
   Server: APISIX/3.4.0
   
   {
     "args": {},
     "data": "",
     "files": {},
     "form": {},
     "headers": {
       "Accept": "*/*",
       "Host": "127.0.0.1",
       "User-Agent": "curl/8.2.1",
       "X-Amzn-Trace-Id": "Root=1-64c7963e-2eb8dbb6349728ee48157d8b",
       "X-Forwarded-Host": "127.0.0.1"
     },
     "json": null,
     "method": "GET",
     "origin": "127.0.0.1, 220.246.124.214",
     "url": "http://127.0.0.1/anything"
   }
   ```


-- 
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] 281743556 commented on issue #9854: bug: rocketmq-logger reseponse body decode fail

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

   > [Jul 20, 2023](#event-9868910019)
   body include Chinese :not
   response has been compress ? not base64 or not gzip,client response receive ok,but rocketmq garbled characters


-- 
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] 281743556 commented on issue #9854: bug: rocketmq-logger reseponse body decode fail

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

   temp plan: 
   body_filter add code 
   ```
   local body = core.response.hold_body_chunk(ctx)
   ctx.resp_body = body 
   ngx.arg[1] = whole
   ```


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