FortiAnalyzer Generic Text Filters, POSIX Subnets & Read-Only `$log` SQL Queries
Hand-typing Log Filters and custom SQL Datasets triggers silent zero-result queries or syntax errors. Use this verified FortiAnalyzer 7.6 reference for POSIX subnet exclusions, strict $log SQL clause ordering, and Event Status triage.
Text Filter Operators: == exact, != not equal, ~ POSIX contains, !~ POSIX excludes, joined by & / and, | / or.
SQL Clause Sequence (Mandatory Order): SELECT → FROM $log → WHERE $filter → GROUP BY → ORDER BY → LIMIT → OFFSET.
⚡ Copy-Ready POSIX & `$log` Dataset Examples
# 1. Generic Text Filter: Exclude 10.0.0.0/8, 192.168.0.0/16 & 172.[20-21].0.0/16
srcip!~"10\.[0-9]+\.[0-9]+\.[0-9]+" and srcip!~"192\.168\.[0-9]+\.[0-9]+" and srcip!~"172\.2[0-1]\.[0-9]+\.[0-9]+"
# 2. Reports > Datasets SQL: Top Denied Policy 0 Flows
select srcip as "Source IP", dstip as "Destination IP", service, count(*) as total_drops
from $log
where $filter and policyid=0
group by srcip, dstip, service
order by total_drops desc
limit 20
Related FortiAnalyzer & FortiGate Guides
❓ Frequently Asked Questions
How do you exclude RFC1918 private subnets in a FortiAnalyzer Generic Text Filter?
Use POSIX not-contained (!~) with backslash-escaped periods: srcip!~"10\.[0-9]+\.[0-9]+\.[0-9]+" and srcip!~"192\.168\.[0-9]+\.[0-9]+" and srcip!~"172\.2[0-1]\.[0-9]+\.[0-9]+".
Why does my FortiAnalyzer Dataset SQL query fail syntax validation?
FortiAnalyzer requires SELECT statements to stay read-only and keep clauses in exact order: FROM, WHERE, GROUP BY, ORDER BY, LIMIT, then OFFSET. Always include $filter inside WHERE so the GUI time window and device filters apply.
Does Mitigated Event Status always mean no further SOC action is required?
Usually blocked or dropped events (Mitigated) can be acknowledged—however, an excessive volume of Mitigated events from a single internal source IP can still indicate an already-compromised device attempting outbound C2 connections.