How do I use Monitor mode to weed out false positives?
Short answer
While the host group runs in Monitor mode, the rule set makes the same inspections as in Blocking mode (signature scanning, structural and parameter inspections, scoring), but the request is not blocked; every request that would be blocked in Blocking mode is written to the WAF Event Logs screen with the Not blocked — Monitor mode decision. The group is switched to Monitor by setting WAF Mode = Monitor Mode in the Edit window on the mode card and is kept there for a period that covers all the workflows. Then, in Event Logs, the untaught records are found by selecting No and Partly in the Learn Status tab of the filter strip, and the most repeated signatures and pages are found with the Signature and Path tabs; in the Attacks tab of each record, the matched section is read and the ones that are false positives are taught with Teach. When the Monitor slice of the WAF Inspection Distribution panel on the Dashboard approaches zero, the group is switched to Blocking Mode. If only one domain name is to be tested, a separate Virtual Host Group is opened for that domain name and only that group is switched to Monitor. The difference from Learning mode: since structural inspections do not run in Learning mode, false positives originating from length, method and allowed lists are seen only in Monitor mode.
Problem: The False Positives Need to Be Seen Before Switching to Blocking Mode
The rule set is ready, but before switching to Blocking mode, it is necessary to see which legitimate requests would be blocked and to clean up these records (When should I move from Learning to Monitor and from Monitor to Blocking?).
Solution: 3 Methods
| Your situation | Suitable method |
|---|---|
| The whole host group will be tested | Method 1: Mode card |
| Only one domain name will be tested | Method 2: Separate Virtual Host Group |
| The mode will be changed from the command line | Method 3: WEB-CLI |
Method 1: Mode Card Recommended
- How it works The host group is switched to Monitor, the records are weeded out as long as the group stays in Monitor mode, and when no false positive remains, the group is switched to Blocking. The mode change does not touch the rules.
- Where it is opened Left Monitor Panel → WAF-Protected vServices → vService → WAF Management → the mode card of the host group → Edit · the Event Logs and Dashboard tabs of the same vService
- Requirement Modify permission in the WAF area; the host group having learned the rule set in Learning mode
- vService type HTTP
Step-by-Step Configuration
In the Left Monitor Panel → WAF-Protected vServices → vService → WAF Management tab, on the mode card of the host group, Edit at the bottom right corner of the title strip is clicked (WAF Mode Edit screen).
WAF Mode = Monitor Mode is selected.
Edit in the window is clicked; no additional confirmation is asked and the change is applied without interrupting the traffic. In a cluster, the change is also sent to the peer device with the default auto-sync; if Manual Sync Mode is on, it is sent manually with Synchronize.
The period the group will stay in Monitor mode is kept long enough to cover all the workflows of the application (such as month-end operations and periodic campaigns).
In the Event Logs tab of the same vService, the Date Range field of the server filter is selected so that it covers the period spent in Monitor mode, and Save & Get Logs is clicked (server filter).
In the Learn Status tab of the filter strip, No and Partly are selected; the Signature tab shows the most triggered signatures at the top, and the Path tab shows the most affected pages at the top (filterable information).
A record is clicked; in the Attacks tab of the preview, Description highlights the matched section. In a group in Monitor mode, all the records are written with the Not blocked — Monitor mode decision (action values); the records in which only a signature whose state is Monitor was triggered are also seen with this decision, but these requests are not blocked in Blocking mode.
Only the attacks that are false positives are checked, Teach is clicked and Yes is selected in the Are you sure? window (How do I allow a request that was blocked by mistake?). Many records of the same signature are taught together by checking the rows while the signature is selected in the Signature tab and using Teach on the toolbar (Can I Allow / Teach several logs at once; are attacks hidden by the filter taught as well?).
In the Dashboard tab of the vService, the Monitor slice of the WAF Inspection Distribution panel is watched (What do the Whitelisted, Clean, Blocked, Monitor, Teacher and Learning categories in WAF Inspection Distribution mean?).
If the Monitor slice is close to zero and the new records come only from real attacks, WAF Mode = Blocking Mode is selected in the Edit window on the mode card and Edit is clicked.
Verification
The mode card of the host group is checked on the WAF Management tab.
Monitor Mode · yellow cardIn Event Logs, the sentence of the Action icon of the new records is checked.
Not blocked — Monitor modeMethod 2: Separate Virtual Host Group
- How it works The domain name to be tested is taken into its own host group and only this group runs in Monitor mode; the other domain names stay in the mode of their own groups (Can I use different modes for different domains on the same vService?).
- Where it is opened Left Monitor Panel → WAF-Protected vServices → vService → WAF Management → Virtual Host Groups band
- Requirement Modify permission in the WAF area; the domain name coming with a separate Host value
- vService type HTTP
Step-by-Step Configuration
On the WAF Management tab, the new group window is opened with the icon at the top right of the Virtual Host Groups band (How is a Host Group added; what goes into the Virtual Host Patterns field?).
Virtual Host Group Name is entered, WAF Mode = Monitor Mode is selected and the domain name is written in the Virtual Host Patterns field (e.g. shop.example.com).
Add is clicked.
The new group does not take the rules of another group; it starts with the default rule set. If the learned rules of the existing group are to be tested, Export is done on the Page Types screen of the source group and Import on that of the new group (Can I export a host group's rule set as JSON and move it to another environment; which settings are not included in the file?).
Steps 4–10 of Method 1 are applied for this group.
Verification
In the Event Logs record of a request that comes to the domain name, the Host Group row in the Request & Location tab of the preview is checked.
Name of the new group · Not blocked — Monitor modeMethod 3: WEB-CLI
- How it works The mode of the host group is changed with the
--modefield of thewaf host-groups updatecommand (optional fields). - Where it is opened TR7 WEB-CLI
- Requirement WEB-CLI access and modify permission in the WAF area
- vService type HTTP
Step-by-Step Configuration
The host groups of the vService and their IDs are listed:
waf host-groups list poolId <vService>The mode of the group is set to Monitor:
waf host-groups update poolId <vService> id <group-id> --mode monitorWhen the Monitor period ends, the same command is run with --mode blocking. The weeding out of the records is done from the interface as in steps 5–9 of Method 1.
Verification
The group record is displayed.
Command: waf host-groups show poolId <vService> <group-id>
monitor in the mode fieldCommon Mistakes
- Keeping the Monitor period short. Periodic flows that do not run while the group is in Monitor mode do not fall into the records and are blocked in Blocking mode.
- Taking the records of a signature whose state is Monitor for false positives. In a group in Monitor mode, these records are also seen with the Not blocked — Monitor mode decision; the request is not blocked in Blocking mode either, and in Blocking mode the same record is written with the Not blocked — Below the blocking threshold decision.
- Switching from Learning mode directly to Blocking. Since structural inspections do not run in Learning mode, the false positives of these inspections are seen for the first time in live traffic (recommended life cycle).
- Confusing the Monitor mode of the host group with the Monitor state of the signature. The mode of the group affects all requests, and the state of the signature affects only that signature (How do I try a new signature in production without risk (Monitor state)?).
How it is done in the documentation
Related questions
