From 0f1196d55f8e2527b4a1e8e9405768a6eca6e86a Mon Sep 17 00:00:00 2001 From: potatso Date: Tue, 4 Jul 2023 13:11:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=20process=5Flogging?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/resty/coraza.lua | 1 + lib/resty/coraza/coraza.lua | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/resty/coraza.lua b/lib/resty/coraza.lua index 53c3844..aa037dd 100644 --- a/lib/resty/coraza.lua +++ b/lib/resty/coraza.lua @@ -132,6 +132,7 @@ function _M.do_body_filter() end function _M.do_log() + coraza.process_logging() local msg = coraza.get_matched_logmsg(ngx_ctx.transaction) ngx_ctx.coraza_msg = msg diff --git a/lib/resty/coraza/coraza.lua b/lib/resty/coraza/coraza.lua index 7949eb0..cd4b774 100644 --- a/lib/resty/coraza/coraza.lua +++ b/lib/resty/coraza/coraza.lua @@ -329,9 +329,17 @@ end function _M.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) coraza.coraza_free_matched_logmsg(c_str) return res 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 \ No newline at end of file