Actions

Actions can be categorized into three types based on their execution timing:

  • Configuration Actions: Such as id, phase, etc., used to define rule metadata.
  • Match-Triggered Actions: Such as setvar, ctl, etc., executed when a single rule matches. A “single rule” here refers to one SecRule, not a parent-child rule chain as a whole.
  • Disruptive Actions: Such as deny, allow, etc., executed after the entire rule (including chained sub-rules) completes matching, typically affecting subsequent rule processing.
KeywordDescription
idUnique rule identifier (required)
phaseProcessing phase (1-5)
msgLog message
severitySeverity level (0-7)
tagRule tag
verRule version
revRule revision
accuracyAccuracy level (1-9)
maturityMaturity level (1-9)
denyDeny request
dropDrop connection
allowAllow request to pass
allow:phaseAllow request to pass current phase
allow:requestAllow the entire request to pass
redirectRedirect to specified URL
passContinue processing subsequent rules
blockUse default disruptive action
logLog to error log
nologDo not log to error log
auditlogLog to audit log
noauditlogDo not log to audit log
logdataLog additional data
captureCapture regex match content
multiMatchExecute action for all matches
setvarSet variable
expirevarSet variable expiration time
setenvSet environment variable
setuidSet user ID
setsidSet session ID
setrscSet resource ID
initcolInitialize persistent collection
chainChain rules together
skipSkip specified number of subsequent rules
skipAfterSkip to a rule with specified marker
ctlModify engine configuration at runtime
execExecute external script or command
statusSet HTTP response status code
xmlnsDefine XML namespace