diff --git a/lib/resty/coraza.lua b/lib/resty/coraza.lua index 16a033d..256df96 100644 --- a/lib/resty/coraza.lua +++ b/lib/resty/coraza.lua @@ -137,4 +137,10 @@ function _M.do_header_filter() ngx_ctx.action, ngx_ctx.status_code = coraza.intervention(ngx_ctx.transaction) end +function _M.do_log() + local msg = coraza.get_matched_logmsg(ngx_ctx.transaction) + ngx_ctx.coraza_msg = msg + +end + return _M diff --git a/lib/resty/coraza/coraza.lua b/lib/resty/coraza/coraza.lua index d97fc42..7949eb0 100644 --- a/lib/resty/coraza/coraza.lua +++ b/lib/resty/coraza/coraza.lua @@ -90,7 +90,8 @@ extern int coraza_free_transaction(coraza_transaction_t t); extern int coraza_free_intervention(coraza_intervention_t* it); extern int coraza_free_waf(coraza_waf_t t); extern coraza_intervention_t* coraza_intervention(coraza_transaction_t tx); - +extern char* coraza_get_matched_logmsg(coraza_transaction_t t); +extern int coraza_free_matched_logmsg(char* t); ]] local _M = { @@ -326,4 +327,11 @@ function _M.process_response_body(transaction) end end +function _M.get_matched_logmsg(transaction) + local c_str = coraza.coraza_get_matched_logmsg(transaction) + local res = ffi.string(c_str) + coraza.coraza_free_matched_logmsg(c_str) + return res +end + return _M \ No newline at end of file