From 34e8b140e5b551c4218e37888e3957bcc4f5e843 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Thu, 19 Oct 2017 23:26:08 -0300 Subject: [PATCH] Setting http response code on the auditlog --- CHANGES | 2 ++ headers/modsecurity/rule_message.h | 3 +++ src/transaction.cc | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 6f4a3eb2..168e87a9 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,8 @@ v3.0.????? - ? --------------------------- + - Setting http response code on the auditlog. + [Issue #1592 - @zimmerle] - Refactoring on RuleMessage class, now accepting http code as parameter. [@zimmerle] - Having disruptive msgs as disruptive [instead of warnings] on audit log diff --git a/headers/modsecurity/rule_message.h b/headers/modsecurity/rule_message.h index d8ae71f1..944e461b 100644 --- a/headers/modsecurity/rule_message.h +++ b/headers/modsecurity/rule_message.h @@ -72,6 +72,9 @@ class RuleMessage { std::string log(int props) { return RuleMessage::log(this, props); } + std::string log(int props, int responseCode) { + return RuleMessage::log(this, props, responseCode); + } std::string errorLog() { return RuleMessage::log(this, ClientLogMessageInfo | ErrorLogTailLogMessageInfo); } diff --git a/src/transaction.cc b/src/transaction.cc index 8eb2bd5f..6aacfdd4 100644 --- a/src/transaction.cc +++ b/src/transaction.cc @@ -1485,7 +1485,7 @@ std::string Transaction::toOldAuditLogFormat(int parts, if (parts & audit_log::AuditLog::HAuditLogPart) { audit_log << "--" << trailer << "-" << "H--" << std::endl; for (auto a : m_rulesMessages) { - audit_log << a.log() << std::endl; + audit_log << a.log(0, m_httpCodeReturned) << std::endl; } audit_log << std::endl; /** TODO: write audit_log H part. */