Skip to content

Commit 2bcbfba

Browse files
committed
Update readme
1 parent 3311753 commit 2bcbfba

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,36 @@ modsecurity_use_error_log
185185

186186
Turns 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

190220
As an open source project we invite (and encourage) anyone from the community to contribute to our project. This may take the form of: new

0 commit comments

Comments
 (0)