zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022942814
> > 现在我已经关闭了我自定义的分流插件
>
> Hi, can it be reproduced with a fresh APISIX? (without any additional code)
>
> Maybe we can add more log when `up_conf` is accessed, like logging the
`tostring(up_conf)` with the route id and upstream id.
可以的,我可以from官方镜像重新打一个包。 但是保留下面这个插件可以吗。我需要在access_log里记录upstream_name
```
local ngx = ngx
local core = require("apisix.core")
local schema = {
type = "object",
properties = {},
required = {}
}
local metadata_schema = {
type = "object",
properties = {},
required = {}
}
local plugin_name = "ky-ngx-vars"
local _M = {
version = 0.1,
priority = 0, -- TODO: add a type field, may be a good idea
name = plugin_name,
schema = schema
}
function _M.check_schema(conf, schema_type)
if schema_type == core.schema.TYPE_METADATA then
return core.schema.check(metadata_schema, conf)
end
return core.schema.check(schema, conf)
end
function _M.before_proxy(conf, ctx)
ngx.var.route_name = ctx.matched_route.value.name
ngx.var.upstream_name = ctx.matched_upstream.name
core.log.debug("set $route_name=", ngx.var.route_name)
core.log.debug("set $upstream_name=", ngx.var.upstream_name)
end
return _M
```
--
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]