feat:添加 process_logging函数

This commit is contained in:
potatso 2023-07-04 13:11:43 +08:00
parent cbde5767f1
commit 0f1196d55f
2 changed files with 9 additions and 0 deletions

View File

@ -132,6 +132,7 @@ function _M.do_body_filter()
end end
function _M.do_log() function _M.do_log()
coraza.process_logging()
local msg = coraza.get_matched_logmsg(ngx_ctx.transaction) local msg = coraza.get_matched_logmsg(ngx_ctx.transaction)
ngx_ctx.coraza_msg = msg ngx_ctx.coraza_msg = msg

View File

@ -329,9 +329,17 @@ end
function _M.get_matched_logmsg(transaction) function _M.get_matched_logmsg(transaction)
local c_str = coraza.coraza_get_matched_logmsg(transaction) local c_str = coraza.coraza_get_matched_logmsg(transaction)
nlog(debug_fmt("Transaction %s uccess to invoke coraza_get_matched_logmsg",
ngx_ctx.request_id))
local res = ffi.string(c_str) local res = ffi.string(c_str)
coraza.coraza_free_matched_logmsg(c_str) coraza.coraza_free_matched_logmsg(c_str)
return res return res
end end
function _M.process_logging(transaction)
coraza.coraza_process_logging(transaction)
nlog(debug_fmt("Transaction %s uccess to invoke coraza_process_logging",
ngx_ctx.request_id))
end
return _M return _M