Cloudflare Audit Log Rule Processing
The following flow chart describes the processing performed on every rule when Cloudflare Audit Log runs.
graph TD
Rule{Rule description} ==> Parsed[full description could be parsed and is valid]Rule ==> NotParsed[description cannot be parsed]Rule ==> IssueID[only the issue ID could be extracted & is valid]
Parsed --> Duration{rule duration}NotParsed --> AbortProcessing[rule processing aborted]IssueID --> CommentWithErrors[leave issue comment with error details]
CommentWithErrors --> AbortProcessingAbortProcessing --> END{end}
Duration ==> LongTerm[long-term]LongTerm --> NoteLongTerm[prepare label `role-duration::long-term`]NoteLongTerm --> ApplyLabels
Duration ==> Temporary[temporary]Temporary --> NoteTemporary[prepare label `role-duration::temporary`]NoteTemporary --> MaxLifetime{maximum lifetime in h}
MaxLifetime ==> Set[explicitly set]MaxLifetime ==> Unset[unset/automatic]
Set --> IsMaxExpired{has elapsed?}IsMaxExpired ==> MaxExpired[yes] --> Expired[has expired]IsMaxExpired ==> MaxNotExpired[no] --> MinLifetime{minimum lifetime in h}NotExpired --> ApplyLabels
Unset --> MinLifetimeMinLifetime ==> MinSet[set, check for value]MinLifetime ==> MinUnset[unset, check for 48h]MinUnset --> MinElapsed{has elapsed}MinSet --> MinElapsed{has elapsed}MinElapsed ==> HasElapsed[yes]MinElapsed ==> HasNotElapsed[no]
HasNotElapsed --> NotExpired[not expired]HasElapsed --> CheckTraffic[Check traffic in last 24h]
CheckTraffic --> NoteTraffic[add the traffic level to the issue comment about to be posted]
NoteTraffic --> ReqCount{> 0 reqests?}ReqCount ==> MoreRequests[yes] --> NotExpiredReqCount ==> NoRequests[no] --> Expired
Expired --> Delete[delete rule in Cloudflare]Delete --> OnError[On error add to the message of the comment about to be posted]OnError --> ApplyLabels
subgraph choose and apply labelsApplyLabels[evaluate rule filter and select candidate labels for `rule-filter`] --> EvaluateType{rule type}EvaluateType ==> TypeBypass['bypass']EvaluateType ==> TypeOther[other]
TypeBypass --> EvaluateBlock[determine matching `bypass-action` labels/firewall `products`]
EvaluateBlock --> RenderComment[render comment before posting - implicit label check]TypeOther --> RenderComment
RenderComment --> MatchComment{matches previous}MatchComment ==> CommentMatch[yes]MatchComment ==> CommentNotMatch[no]
CommentNotMatch --> Comment[comment status on issue & apply labels]end
CommentMatch --> ENDComment --> END
subgraph expiry detectionMaxLifetimeSetIsMaxExpiredMaxNotExpiredMaxExpiredExpiredNotExpiredUnsetMinLifetimeMinSetMinUnsetMinElapsedHasElapsedHasNotElapsedCheckTrafficNoteTrafficReqCountMoreRequestsNoRequestsend