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

   ### Description
   
   I compiled the 
http_wasm_example.cc(https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/blob/main/example/http_wasm_example.cc)
 of proxy-wasm-cpp-sdk into a wasm file and configured it in APISIX, but it 
seems to be ineffective, and the logs are not being printed properly. What 
should I do?
   This is the compilation 
step:https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/blob/main/docs/building.md
   
   APISIX's config.yaml:
   
   ```yaml
   wasm:
     plugins:
       - name: SensitiveWordsFilter
         priority: 7997
         file: 
/usr/local/apisix/extra_plugins_ex/apisix/plugins/SensitiveWordsFilter.wasm
       - name: example_wasm
         priority: 7997
         file: 
/usr/local/apisix/extra_plugins_ex/apisix/plugins/http_wasm_example.wasm
         http_request_phase: rewrite
   ```
   
   and the logs:
   
   ```
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: /download/ operator: <=, client: xxx, server: _, 
request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:393: 
insert_route(): insert route path: /download/ dataprt: 1, client: xxx, server: 
_, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: /download/ operator: =, client: xxx, server: _, 
request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: / operator: =, client: xxx, server: _, request: "GET 
/ HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: /web-test/ operator: <=, client: xxx, server: _, 
request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:393: 
insert_route(): insert route path: /web-test/ dataprt: 2, client: xxx, server: 
_, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: 
/ingress/api/xxg-8df4e3/b997ee5121dd4513a6baa2e349ecdc0a/ai-0697719591c540d7bbbdfdc9e6523ba9/service-1cf8056545cf4743a3797e0d96fde02c/plate
 operator: =, client: xxx, server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: 
/ingress/api/xxg-8df4e3/b997ee5121dd4513a6baa2e349ecdc0a/ai-9a04602a30fa45e790d4e42ceec3d2a4/service-0fe53fbc92474b4195c817558d4e5bce/maskdetect
 operator: =, client: xxx, server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: 
/ingress/api/xxg-8df4e3/b997ee5121dd4513a6baa2e349ecdc0a/ai-6192d1d9139f4bc4aef27f6f57eef2dc/service-75a8ec1b7f5e456380c92bdcacdfeff4/trash_detect
 operator: =, client: xxx, server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: 
/ingress/api/xxg-8df4e3/b997ee5121dd4513a6baa2e349ecdc0a/ai-d4d81ccffff9482e8acdacb5b3874d7f/service-107c4c2abbc84c3e93276e9acf899c30/illegalparking
 operator: =, client: xxx, server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: 
/ingress/api/xxg-8df4e3/b997ee5121dd4513a6baa2e349ecdc0a/ai-b6a2dd366ae442968773c24729e73e6a/service-700332a3e02b4bb09f0ed814c418e2c6/person
 operator: =, client: xxx, server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:393: 
insert_route(): insert route path: /jiutian dataprt: 3, client: xxx, server: _, 
request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: /registry/ operator: <=, client: xxx, server: _, 
request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:393: 
insert_route(): insert route path: /registry/ dataprt: 4, client: xxx, server: 
_, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:493: 
common_route_data(): path: /registry/v2/ operator: <=, client: xxx, server: _, 
request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree.lua:393: 
insert_route(): insert route path: /registry/v2/ dataprt: 5, client: xxx, 
server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] radixtree_host_uri.lua:161: 
match(): route match mode: radixtree_host_uri, client: xxx, server: _, request: 
"GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] init.lua:633: 
http_access_phase(): matched route: 
{"has_domain":true,"key":"/apisix/routes/10006","value":{"update_time":1732695934,"create_time":1732670274,"priority":7997,"id":"10006","methods":["GET"],"upstream":{"pass_host":"pass","nodes":[{"host":"my-download-service","weight":1,"port":80}],"hash_on":"vars","type":"roundrobin","scheme":"http","parent":{"has_domain":true,"key":"/apisix/routes/10006","value":"table:
 0x7f31b83d0060","modifiedIndex":861,"clean_handlers":"table: 
0x7f31b5c95598","orig_modifiedIndex":861,"createdIndex":783}},"status":1,"uri":"/","plugins":{"file-logger":{"path":"/usr/local/apisix/extra_plugins_ex/file.log","include_req_body":true,"include_resp_body":true},"example_wasm":{"conf":"{\"http_status\":200,
 \"body\":\"Hello 
WebAssembly!\n\"}"}}},"modifiedIndex":861,"clean_handlers":{},"orig_modifiedIndex":861,"createdIndex":783},
 client: xxx, server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: create plugin context 1
   2024/11/28 02:46:00 [info] 53#53: create http context 2
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] client.lua:123: dns_parse(): 
dns resolve my-download-service, result: 
{"type":1,"ttl":600,"section":1,"name":"my-download-service","address":"xxx","class":1},
 client: xxx, server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] resolver.lua:84: 
parse_domain(): parse addr: 
{"type":1,"ttl":600,"section":1,"name":"my-download-service","class":1,"address":"xxx"},
 client: xxx, server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] resolver.lua:85: 
parse_domain(): resolver: ["127.0.0.11"], client: xxx, server: _, request: "GET 
/ HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] resolver.lua:86: 
parse_domain(): host: my-download-service, client: xxx, server: _, request: 
"GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] resolver.lua:88: 
parse_domain(): dns resolver domain: my-download-service to xxx, client: xxx, 
server: _, request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] init.lua:259: 
parse_domain_in_route(): parse route which contain domain: 
{"orig_modifiedIndex":861,"has_domain":true,"value":"table: 
0x7f31b83d0060","key":"/apisix/routes/10006","modifiedIndex":861,"clean_handlers":"table:
 
0x7f31b5c95598","dns_value":{"update_time":1732695934,"create_time":1732670274,"priority":7997,"id":"10006","methods":["GET"],"upstream":{"pass_host":"pass","nodes":[{"host":"xxx","domain":"my-download-service","weight":1,"port":80}],"hash_on":"vars","scheme":"http","type":"roundrobin","parent":{"orig_modifiedIndex":861,"has_domain":true,"value":{"update_time":1732695934,"create_time":1732670274,"priority":7997,"id":"10006","methods":["GET"],"upstream":{"pass_host":"pass","nodes":[{"host":"my-download-service","weight":1,"port":80}],"hash_on":"vars","type":"roundrobin","scheme":"http","parent":"table:
 
0x7f31b83d8430"},"status":1,"uri":"/","plugins":{"file-logger":{"path":"/usr/local/apisix/extra_plugins_ex/file.log"
 
,"include_req_body":true,"include_resp_body":true},"example_wasm":{"conf":"{\"http_status\":200,
 \"body\":\"Hello WebAssembly!\n\"}","plugin_ctxs":{"route#10006":"cdata<void 
*>: 
0x55a2e222e3f0"}}}},"key":"/apisix/routes/10006","modifiedIndex":861,"clean_handlers":{},"dns_value":"table:
 
0x7f31b60d89e0","createdIndex":783}},"status":1,"uri":"/","plugins":{"file-logger":{"path":"/usr/local/apisix/extra_plugins_ex/file.log","include_req_body":true,"include_resp_body":true},"example_wasm":{"plugin_ctxs":{"route#10006":"cdata<void
 *>: 0x55a2e222e3f0"},"conf":"{\"http_status\":200, \"body\":\"Hello 
WebAssembly!\n\"}"}}},"createdIndex":783}, client: xxx, server: _, request: 
"GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] balancer.lua:196: 
pick_server(): ctx: 
{"conf_id":"10006","real_curr_req_matched_path":"/","route_id":"10006","conf_version":861,"plugins":[{"check_schema":"function:
 
0x7f31b86c1428","priority":7997,"version":0.1,"name":"example_wasm","header_filter":"function:
 0x7f31b863a708","body_filter":"function: 0x7f31b863a748","rewrite":"function: 
0x7f31b863a690","type":"wasm","schema":{"type":"object","properties":{"conf":{"oneOf":[{"type":"object","minProperties":1},{"type":"string","minLength":1}]},"_meta":{"type":"object","properties":{"disable":{"type":"boolean"},"filter":{"description":"filter
 determines whether the plugin needs to be executed at 
runtime","type":"array"},"error_response":{"oneOf":[{"type":"string"},{"type":"object"}]},"priority":{"description":"priority
 of plugins by customized 
order","type":"integer"}}}},"required":["conf"],"$comment":"this is a mark for 
our injected plugin schema"},"plugin":"cdata<void *>: 0x55a2e22b79f0
 "},{"conf":"{\"http_status\":200, \"body\":\"Hello 
WebAssembly!\n\"}","plugin_ctxs":{"route#10006":"cdata<void *>: 
0x55a2e222e3f0"}},{"check_schema":"function: 0x7f31b61553f0","log":"function: 
0x7f31b6155dc8","body_filter":"function: 
0x7f31b6155d58","priority":399,"version":0.1,"name":"file-logger","schema":{"type":"object","properties":{"path":{"type":"string"},"include_req_body":{"type":"boolean","default":false},"include_resp_body":{"type":"boolean","default":false},"match":{"type":"array","items":{"type":"array"},"maxItems":20},"include_req_body_expr":{"type":"array","items":{"type":"array"},"minItems":1},"_meta":"table:
 
0x7f31b861bea8","include_resp_body_expr":{"type":"array","items":{"type":"array"},"minItems":1},"log_format":{"type":"object"}},"required":["path"],"$comment":"this
 is a mark for our injected plugin 
schema"},"metadata_schema":{"type":"object","properties":{"log_format":{"type":"object"}}}},{"path":"/usr/local/apisix/extra_plugins_ex/file.log","include_req_body":
 
true,"include_resp_body":true}],"matched_route":{"orig_modifiedIndex":861,"has_domain":true,"value":{"update_time":1732695934,"create_time":1732670274,"priority":7997,"id":"10006","methods":["GET"],"upstream":{"pass_host":"pass","nodes":[{"host":"my-download-service","weight":1,"port":80}],"hash_on":"vars","type":"roundrobin","scheme":"http","parent":"table:
 0x7f31b83d8430"},"status":1,"uri":"/","plugins":{"file-logger":"table: 
0x7f31b83d1010","example_wasm":"table: 
0x7f31b83d11b8"}},"key":"/apisix/routes/10006","modifiedIndex":861,"clean_handlers":{},"dns_value":{"update_time":1732695934,"create_time":1732670274,"priority":7997,"id":"10006","methods":["GET"],"upstream":{"pass_host":"pass","nodes":[{"port":80,"domain":"my-download-service","priority":0,"host":"xxx","weight":1}],"hash_on":"vars","scheme":"http","type":"roundrobin","parent":"table:
 
0x7f31b83d8430","original_nodes":[{"host":"xxx","domain":"my-download-service","weight":1,"port":80}],"nodes_ref":"table:
 0x7f31b84e00b0"}
 
,"status":1,"uri":"/","plugins":{"file-logger":{"path":"/usr/local/apisix/extra_plugins_ex/file.log","include_req_body":true,"include_resp_body":true},"example_wasm":{"plugin_ctxs":{"route#10006":"cdata<void
 *>: 0x55a2e222e3f0"},"conf":"{\"http_status\":200, \"body\":\"Hello 
WebAssembly!\n\"}"}}},"createdIndex":783},"upstream_conf":"table: 
0x7f31b6115d18","upstream_key":"10006","var":{"_ctx":{"conf_id":"10006","real_curr_req_matched_path":"/","route_id":"10006","conf_version":861,"plugins":"table:
 0x7f31b5da66a8","matched_route":"table: 
0x7f31b83d8430","upstream_conf":"table: 
0x7f31b6115d18","upstream_key":"10006","var":"table: 
0x7f31b60f9ad8","curr_req_matched":{"_path":"/","_method":"GET"},"matched_upstream":"table:
 
0x7f31b6115d18","conf_type":"route","upstream_scheme":"http","debug_headers":{"file-logger":true,"example_wasm":true},"upstream_version":"861#table:
 
0x7f31b6115d18"},"_cache":{"request_method":"GET","remote_addr":"xxx","scheme":"http","host":"xxx","real_request_uri":"/
 ","upstream_scheme":"http","uri":"/","request_uri":"/"},"_request":"cdata
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] balancer.lua:384: run(): 
proxy request to xxx:80 while connecting to upstream, client: xxx, server: _, 
request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] balancer.lua:384: run(): 
proxy request to xxx:80 while connecting to upstream, client: xxx, server: _, 
request: "GET / HTTP/1.0", host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: *42333 [lua] log-util.lua:261: 
get_log_entry(): metadata: null while logging request, client: xxx, server: _, 
request: "GET / HTTP/1.0", upstream: "http://xxx:80/";, host: "xxx"
   2024/11/28 02:46:00 [info] 53#53: free http context 2
   ```
   
   
   
   
   ### Environment
   
   - APISIX version (run `apisix version`):3.10.0
   - Operating system (run `uname -a`):Debian 11
   - OpenResty / Nginx version (run `openresty -V` or `nginx 
-V`):openresty/1.27.1.1
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):3.5.11
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to