src/transaction.cc
/**
 * @name    processLogging
 * @brief   Logging all information relative to this transaction.
 *
 * At this point there is not need to hold the connection, the response can be
 * delivered prior to the execution of this method.
 *
 * @returns If the operation was successful or not.
 * @retval true Operation was successful.
 * @retval false Operation failed.
 *
 */
@name    processLogging
@brief   Logging all information relative to this transaction.

At this point there is not need to hold the connection, the response can be
delivered prior to the execution of this method.

@returns If the operation was successful or not.
@retval true Operation was successful.
@retval false Operation failed.
@name processLogging @brief Logging all information relative to this transaction . At this point there is not need to hold the connection the response can be delivered prior to the execution of this method . @returns If the operation was successful or not . @retval true Operation was successful . @retval false Operation failed .
int Transaction::processLogging() {
#ifndef NO_LOGS
    debug(4, "Starting phase LOGGING. (SecRules 5)");
#endif
    if (m_rules->m_secRuleEngine == Rules::DisabledRuleEngine) {
#ifndef NO_LOGS
        debug(4, "Rule engine disabled, returning...");
#endif
        return true;
    }
    this->m_rules->evaluate(modsecurity::LoggingPhase, this);
    if (m_rules != NULL && m_rules->m_auditLog != NULL) {
        int parts = this->m_rules->m_auditLog->getParts();
#ifndef NO_LOGS
        debug(8, "Checking if this request is suitable to be " \
            "saved as an audit log.");
#endif
        if (this->m_auditLogModifier.size() > 0) {
#ifndef NO_LOGS
            debug(4, "There was an audit log modifier for this transaction.");
#endif
            std::list<std::pair<int, std::string>>::iterator it;
            debug(7, "AuditLog parts before modification(s): " +
                std::to_string(parts) + ".");
            for (it = m_auditLogModifier.begin();
                it != m_auditLogModifier.end(); ++it) {
                std::pair <int, std::string> p = *it;
                if (p.first == 0) {  
                    parts = this->m_rules->m_auditLog->addParts(parts,
                        p.second);
                } else {  
                    parts = this->m_rules->m_auditLog->removeParts(parts,
                        p.second);
                }
            }
        }
        debug(8, "Checking if this request is relevant to be " \
            "part of the audit logs.");
        bool saved = this->m_rules->m_auditLog->saveIfRelevant(this, parts);
        if (saved) {
#ifndef NO_LOGS
            debug(8, "Request was relevant to be saved. Parts: " +
                std::to_string(parts));
#endif
        }
    }
    return true;
}
int Transaction :: processLogging ( ) { #ifndef NO_LOGS debug ( 4 , " " ) ; #endif if ( m_rules -> m_secRuleEngine == Rules :: DisabledRuleEngine ) { #ifndef NO_LOGS debug ( 4 , " " ) ; #endif return true ; } this -> m_rules -> evaluate ( modsecurity :: LoggingPhase , this ) ; if ( m_rules != NULL && m_rules -> m_auditLog != NULL ) { int parts = this -> m_rules -> m_auditLog -> getParts ( ) ; #ifndef NO_LOGS debug ( 8 , " " " " ) ; #endif if ( this -> m_auditLogModifier . size ( ) > 0 ) { #ifndef NO_LOGS debug ( 4 , " " ) ; #endif std :: list < std :: pair < int , std :: string > > :: iterator it ; debug ( 7 , " " + std :: to_string ( parts ) + " " ) ; for ( it = m_auditLogModifier . begin ( ) ; it != m_auditLogModifier . end ( ) ; ++ it ) { std :: pair < int , std :: string > p = * it ; if ( p . first == 0 ) { parts = this -> m_rules -> m_auditLog -> addParts ( parts , p . second ) ; } else { parts = this -> m_rules -> m_auditLog -> removeParts ( parts , p . second ) ; } } } debug ( 8 , " " " " ) ; bool saved = this -> m_rules -> m_auditLog -> saveIfRelevant ( this , parts ) ; if ( saved ) { #ifndef NO_LOGS debug ( 8 , " " + std :: to_string ( parts ) ) ; #endif } } return true ; }
@name    processLogging
 @brief   Logging all information relative to this transaction.
@name processLogging @brief Logging all information relative to this transaction .
/* If relevant, save this transaction information at the audit_logs */ // Add // Remove