tzssangglass commented on issue #5596: URL: https://github.com/apache/apisix/issues/5596#issuecomment-979207002
```diff diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua index f5fa5d6e..90adf47d 100644 --- a/apisix/cli/ngx_tpl.lua +++ b/apisix/cli/ngx_tpl.lua @@ -578,6 +578,7 @@ http { set $dubbo_service_version ''; set $dubbo_method ''; {% end %} + set $upstream_name ''; access_by_lua_block { apisix.http_access_phase() diff --git a/apisix/init.lua b/apisix/init.lua index 801809f6..816352bf 100644 --- a/apisix/init.lua +++ b/apisix/init.lua @@ -505,6 +505,9 @@ function _M.http_access_phase() or route_val.upstream end + -- need to care of matched_upstream + ngx.var.upstream_name = api_ctx.matched_upstream.parent.value.name + if enable_websocket then api_ctx.var.upstream_upgrade = api_ctx.var.http_upgrade api_ctx.var.upstream_connection = api_ctx.var.http_connection diff --git a/conf/config.yaml b/conf/config.yaml index dd9bd565..c7871dae 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -35,5 +35,6 @@ apisix: - name: admin key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has security risk, please update it when you deploy to production environment role: admin -ext-plugin: - path_for_test: /tmp/runner.sock +nginx_config: + http: + access_log_format: "$remote_addr - $remote_user [$time_local] $http_host \"$request\" $status $body_bytes_sent $request_time \"$http_referer\" \"$http_user_agent\" $upstream_name $upstream_addr $upstream_status $upstream_response_time \"$upstream_scheme://$upstream_host$upstream_uri\"" ``` try this, just an idea. you need to complate this by yourself. -- 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-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org