Adds verbose logs to audit logs while deciding or not to save a request

This commit is contained in:
Felipe Zimmerle 2016-02-12 11:51:33 -03:00
parent 77a1dcab9b
commit 362b376acb
2 changed files with 11 additions and 1 deletions

View File

@ -228,6 +228,11 @@ bool AuditLog::saveIfRelevant(Transaction *transaction) {
bool AuditLog::saveIfRelevant(Transaction *transaction, int parts) {
if (this->isRelevant(transaction->m_httpCodeReturned) == false &&
transaction->m_toBeSavedInAuditlogs == false) {
transaction->debug(5, "Return code `" +
std::to_string(transaction->m_httpCodeReturned) + "'" \
" is not interesting to audit logs, relevant code(s): `" +
m_relevant + "'.");
return false;
}
@ -237,12 +242,16 @@ bool AuditLog::saveIfRelevant(Transaction *transaction, int parts) {
*
*/
if (transaction->m_toNotBeSavedInAuditLogs == true) {
transaction->debug(5, "This request was marked to not " \
"be saved in the audit logs.");
return false;
}
if (parts == -1) {
parts = m_parts;
}
transaction->debug(5, "Saving this request as part " \
"of the audit logs.");
m_writer->write(transaction, parts);
return true;

View File

@ -1213,7 +1213,8 @@ int Transaction::processLogging(int returned_code) {
"saved via auditlog action.");
}
#endif
debug(8, "Checking if this request is relevant to be " \
"part of the audit logs.");
bool saved = this->m_rules->audit_log->saveIfRelevant(this, parts);
if (saved) {
#ifndef NO_LOGS