File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -185,6 +185,36 @@ modsecurity_use_error_log
185185
186186Turns on or off ModSecurity error log functionality.
187187
188+ # Variables
189+
190+ This module exposes the following variables that can be used in ` log_format ` or anywhere else nginx variables are valid.
191+
192+ modsecurity_intervention
193+ -------------------------
194+ ** value:** * ` 1 ` if ModSecurity triggered a disruptive intervention
195+ (deny, redirect, etc.) on the request, ` 0 ` otherwise*
196+
197+ modsecurity_triggered_rules
198+ ----------------------------
199+ ** value:** * comma-separated list of matched rule IDs (e.g. ` 941100,949110 ` ),
200+ or ` - ` when no rule matched*
201+
202+ ``` nginx
203+ log_format modsec '$remote_addr [$time_local] "$request" $status '
204+ 'intervention=$modsecurity_intervention '
205+ 'rules=$modsecurity_triggered_rules';
206+
207+ server {
208+ listen 8080;
209+ modsecurity on;
210+ modsecurity_rules_file /etc/modsecurity.d/modsecurity.conf;
211+ access_log logs/modsec-access.log modsec;
212+ location / {
213+ ...
214+ }
215+ }
216+ ```
217+
188218# Contributing
189219
190220As an open source project we invite (and encourage) anyone from the community to contribute to our project. This may take the form of: new
You can’t perform that action at this time.
0 commit comments