mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Refactoring: how to report to error logs
This commit is contained in:
@@ -23,6 +23,36 @@
|
||||
|
||||
namespace modsecurity {
|
||||
|
||||
std::string RuleMessage::disruptiveErrorLog(Transaction *trans, std::string msg2) {
|
||||
std::string msg;
|
||||
|
||||
msg.append("[client " + std::string(trans->m_clientIpAddress) + "]");
|
||||
msg.append(" ModSecurity: ");
|
||||
msg.append(msg2);
|
||||
msg.append(m_match);
|
||||
msg.append(" [file \"" + std::string(m_ruleFile) + "\"]");
|
||||
msg.append(" [line \"" + std::to_string(m_ruleLine) + "\"]");
|
||||
msg.append(" [id \"" + std::to_string(m_ruleId) + "\"]");
|
||||
msg.append(" [rev \"" + m_rev + "\"]");
|
||||
msg.append(" [msg \"" + m_message + "\"]");
|
||||
msg.append(" [data \"" + m_data + "\"]");
|
||||
msg.append(" [severity \"" +
|
||||
std::to_string(m_severity) + "\"]");
|
||||
msg.append(" [ver \"" + m_ver + "\"]");
|
||||
msg.append(" [maturity \"" + std::to_string(m_maturity) + "\"]");
|
||||
msg.append(" [accuracy \"" + std::to_string(m_accuracy) + "\"]");
|
||||
for (auto &a : m_tags) {
|
||||
msg.append(" [tag \"" + a + "\"]");
|
||||
}
|
||||
msg.append(" [hostname \"" + std::string(trans->m_serverIpAddress) \
|
||||
+ "\"]");
|
||||
msg.append(" [uri \"" + trans->m_uri_no_query_string_decoded + "\"]");
|
||||
msg.append(" [unique_id \"" + trans->m_id + "\"]");
|
||||
|
||||
return modsecurity::utils::string::toHexIfNeeded(msg);
|
||||
|
||||
}
|
||||
|
||||
std::string RuleMessage::errorLog(Transaction *trans) {
|
||||
std::string msg;
|
||||
|
||||
|
Reference in New Issue
Block a user