va3093 commented on issue #5092:
URL: https://github.com/apache/apisix/issues/5092#issuecomment-1588831495
I fixed this by adding the following `module_hook`
```lua
local apisix = require("apisix")
local old_http_init = apisix.http_init
apisix.http_init = function (...)
ngx.log(ngx.EMERG, "Module hooks loaded")
old_http_init(...)
end
local exporter = require("apisix.plugins.prometheus.exporter")
local old_http_log = exporter.http_log
exporter.http_log = function (conf, ctx)
ctx.balancer_ip = "_overwritten_"
old_http_log(conf, ctx)
end
```
I put that in a config map and loaded it into the apisix config using the
following config in my helmchart values.yml file.
```yaml
luaModuleHook:
enabled: true
luaPath: "/usr/local/apisix/apisix/module_hooks/?.lua"
hookPoint: "module_hook"
configMapRef:
name: "apisix-module-hooks"
mounts:
- key: "module_hook.lua"
path: "/usr/local/apisix/apisix/module_hooks/module_hook.lua"
```
--
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]