modify log-format, then every plugin log is associated with access log (#1454)

This commit is contained in:
rinfx
2024-11-04 22:04:20 +08:00
committed by GitHub
parent 63d5422da6
commit 7e8b0445ad
2 changed files with 14 additions and 2 deletions

View File

@@ -370,6 +370,8 @@ func (ctx *CommonHttpCtx[PluginConfig]) SetResponseBodyBufferLimit(size uint32)
}
func (ctx *CommonHttpCtx[PluginConfig]) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
requestID, _ := proxywasm.GetHttpRequestHeader("x-request-id")
_ = proxywasm.SetProperty([]string{"x_request_id"}, []byte(requestID))
config, err := ctx.plugin.GetMatchConfig()
if err != nil {
ctx.plugin.vm.log.Errorf("get match config failed, err:%v", err)