ADR-0035: `noauditlog` affects relevance only; the audit record lists every logged match
- Status: accepted
- Date: 2026-11-09
- Accepted: 2026-11-11
- Deciders: @fzipi, @xanadu, @M4tteoP, @airween, @franbuehler, @theseion
- Category: Divergence
Context
10-logging.md#audit-log-relevance decides which transactions get an audit record: a
matched rule with auditlog and not noauditlog, OR a status matching
SecAuditLogRelevantStatus. It does not decide which matched rules the record lists in
part H. The engines differ for a rule with log,noauditlog, checked with the three
reference adapters (RelevantOnly, Native format, a log,noauditlog rule and a deny that
makes the transaction relevant):
| Matched rule | v2.9.15 | v3.0.17 | Coraza v3.8.1 |
|---|---|---|---|
log,noauditlog | listed | not listed | not listed |
nolog,auditlog | listed | listed | listed |
nolog, nolog,noauditlog | not listed | not listed | not listed |
- ModSecurity v2 (
apache2/re.cmsre_perform_disruptive_actionsandmsc_alert) adds the message of every rule that logs, or that carriesauditlogundernolog, tomsr->alerts, whichapache2/msc_logging.cwrites as part HMessage:lines;noauditlogonly stops the rule from making the transaction relevant. - libmodsecurity v3 keeps one flag for both logs:
logandauditlogsetRuleMessage::m_saveMessage,nologandnoauditlogclear it (src/actions/log.cc,audit_log.cc,no_log.cc,no_audit_log.cc), and part H writes only saved messages (src/transaction.cctoOldAuditLogFormat). The last of the four actions wins. - Coraza lists a rule in part H only when its audit flag is set
(
internal/corazawaf/transaction.goAuditLog), whichnoauditlogclears.
With v3’s and Coraza’s reading, an operator who wants records only for relevant statuses
(SecDefaultAction "phase:2,log,noauditlog,pass" with SecAuditLogRelevantStatus) gets a
record for a blocked request that does not say which rules matched.
Decision
noauditlog only stops a rule from making the transaction relevant. Part H of a written
record MUST list every matched rule that carries log or auditlog, explicitly or through
SecDefaultAction, whether or not it carries noauditlog. A rule with nolog and no
explicit auditlog is not listed. Relevance is unchanged
(10-logging.md#audit-log-relevance).
Both common setups then work:
- CRS defaults (
log,auditlog): every detection makes a record listing its rules. - Status decides (
SecDefaultActionwithlog,noauditlog,passand aSecAuditLogRelevantStatus): only a relevant status makes a record, and the record still lists every rule that matched.
Options considered
- v3’s single flag, last action wins:
noauditloghides the cause of a recorded block, and no configuration gives “status decides, the record shows what matched”; rejected. - Leave part H’s content unspecified: the record of a blocked request may or may not name the rule that blocked it; rejected.
- v2’s reading (chosen): one action decides relevance, the other what is listed.
Consequences
- For ModSecurity v2: none.
- For libmodsecurity v3: keep the error-log and audit-record decisions apart:
noauditlogmust not clear the messagelogsaved. - For Coraza: list rules with the log flag in part H even when the audit flag is cleared;
relevance remains the separate OR of
10-logging.md#audit-log-relevance(the known gap recorded incompat/known-gaps.md). - For rule authors:
log,noauditlogis the way to keep a rule from creating records on its own while keeping it visible in every record that is written.
Tests
References
- ADR-0021
spec/10-logging.md#audit-log-relevance,spec/10-logging.md#audit-log-parts- Report by @M4tteoP, 2026-11-09; Coraza PR 1824 (relevance as OR)