Overview
Suricata is a high-performance open-source IDS, IPS, and network security monitor. It inspects traffic against signature rules to raise alerts (IDS), can block matching traffic inline (IPS), and, like Zeek, writes structured protocol logs and extracts files. It's multi-threaded, understands many application protocols, and reads the same rule format used across the industry.
Common uses: alerting on known-bad traffic with community rulesets, blocking it inline at a gateway, and producing eve.json metadata for a SIEM.
Install
# Debian / Ubuntu (official PPA has current versions)
sudo add-apt-repository ppa:oisf/suricata-stable
sudo apt update && sudo apt install suricata
# Fedora / RHEL
sudo dnf install suricata
# macOS (Homebrew)
brew install suricata
suricata --build-info | head # confirm features (NFQ, etc.) are compiled inMain config lives at /etc/suricata/suricata.yaml. Set your HOME_NET (the networks you're protecting) there before going live.
Rules and updates
Suricata ships almost no rules; you pull them in. suricata-update fetches and manages rulesets (ET Open by default):
sudo suricata-update # fetch/update the default ruleset
sudo suricata-update list-sources # available rule sources
sudo suricata-update enable-source et/open # Emerging Threats open ruleset
sudo suricata-update # re-run to applyRules end up in /var/lib/suricata/rules/suricata.rules.
Testing config and rules
Always validate before restarting a live sensor:
sudo suricata -T -c /etc/suricata/suricata.yaml -v # test config + rules, then exitReading a pcap offline
Great for tuning rules and checking a capture against your ruleset:
mkdir out
suricata -r capture.pcap -l out/ # run rules over a pcap, logs into out/
ls out/
# eve.json fast.log stats.log suricata.logIDS mode (alerting) on live traffic
# AF_PACKET on a monitoring interface (modern default on Linux)
sudo suricata -c /etc/suricata/suricata.yaml -i eth0
# As a managed service
sudo systemctl enable --now suricata
sudo systemctl status suricataIPS mode (inline blocking)
Inline mode requires routing traffic through Suricata via NFQUEUE (iptables/nftables) or AF_PACKET bridging. NFQUEUE example:
# Send forwarded traffic to queue 0
sudo iptables -I FORWARD -j NFQUEUE --queue-num 0
# Run Suricata reading that queue
sudo suricata -c /etc/suricata/suricata.yaml -q 0Rules with a drop action then actually block. Validate rules in IDS mode first; a bad inline rule can take down legitimate traffic.
Output: fast.log and eve.json
fast.log: one-line, human-readable alerts, good for a quick look:
tail -f /var/log/suricata/fast.logeve.jsonis the real output: JSON events for alerts, plus flow, DNS, HTTP, TLS, and file records. This is what you ship to a SIEM.
# Alert signatures seen, most frequent first
jq -r 'select(.event_type=="alert") | .alert.signature' /var/log/suricata/eve.json \
| sort | uniq -c | sort -rn | head
# TLS SNI values
jq -r 'select(.event_type=="tls") | .tls.sni' /var/log/suricata/eve.json | sort -u
# Alerts involving one host
jq 'select(.event_type=="alert" and .src_ip=="192.0.2.10")' /var/log/suricata/eve.jsonRule syntax (reading and writing)
A rule is: action · header (proto, source, direction, destination) · options in parentheses.
alert http $HOME_NET any -> $EXTERNAL_NET any ( \
msg:"Example suspicious user-agent"; \
flow:established,to_server; \
http.user_agent; content:"BadAgent/1.0"; \
classtype:bad-unknown; sid:1000001; rev:1; )action:alert,drop(IPS),reject,passflow: direction/state, e.g.established,to_server- sticky buffers like
http.user_agent,http.uri,dns.query,tls.sniscope the match content:"..."is the match;sidmust be unique; bumprevwhen you edit
Test a custom rule over a pcap:
suricata -S my.rules -r capture.pcap -l out/
grep 1000001 out/fast.logTips
- Set
HOME_NETcorrectly. Many rules fire based on direction relative to it. - Run
suricata -Tbefore every restart; a syntax error otherwise leaves the sensor down. - Keep custom rules in their own file with
sids from the 1,000,000+ local range. eve.jsonis the integration point for Elastic (the ELK/EveBox stack), Splunk, orjq.- IPS mode: stage as IDS, confirm no false positives on your traffic, then switch chosen rules to
drop. - Run Suricata and Zeek together: signature alerts from one, full protocol logs from the other.