Quiz Entry - updated: 2026.11.26
What are the parts of a Suricata rule?
Action, header (protocol, source IP and port, direction, destination IP and port), and options in parentheses (message, detection keywords, sid, rev, classtype…).
* Action, then the header that selects the traffic, then the options that describe the match. *
alert tcp any any -> any any (msg:"Suricata NIDS - Testing"; content:"evilliveshere"; nocase; classtype:not-suspicious; sid:1234567; rev:1;)
└─┬─┘ └┬┘ └┬┘ └┬┘ └┬┘ └┬┘ └┬┘ └────────────────────────────── options ──────────────────────────────┘
action proto src sport dir dst dport
- Action: what to do on a match.
alertlogs an alert;passstops inspecting the packet;dropandrejectblock it, which only works when Suricata runs inline as an IPS. - Header:
- protocol (
tcp,udp,icmp,ipfor all, or an application protocol such ashttp), - source address and port (
any, an IP or CIDR, or a variable such as$HOME_NET), - direction:
->from source to destination,<>both ways, - destination address and port.
- protocol (
- Options, separated by semicolons: general (meta) options such as
msg,sid,rev,classtypeandreference, and detection options such ascontent,nocase,pcreandflow.
The header narrows down which traffic is examined; the detection options decide whether it matches.
Go deeper:
Suricata: Rules Format — the canonical breakdown of action, header and options, with a colour-coded example.
Suricata: Differences from Snort — where the rule language departs from Snort's, which matters when reusing older rules.