Repository navigation
Forwarder Installation
Complete guide for deploying the Python-based Suricata log forwarder on pfSense.
Use
./setup.sh. Step 4 ofsetup.shdeploys the forwarder, the watchdog, the cron entry and the rc.d service to pfSense over SSH, and starts it. Everything below the Configuration section is reference material and a manual fallback for when you cannot runsetup.sh. Do not mix the two: if you installed manually, re-running./setup.shlater is safe and will replace your manual copies.
- pfSense 2.7.2 or later (2.8.1 tested; 2.9.0 supported with the caveats in the pfSense Upgrade Guide)
- Suricata installed and running on at least one interface
- SSH access to pfSense (enable in System > Advanced > Secure Shell), key-based
(
ssh-copy-id admin@<PFSENSE_IP>) — the scripts never prompt for passwords - Network connectivity from pfSense to the SIEM server on UDP 5140
Python: pfSense ships Python 3 with the Suricata package (python3.11 on 2.8.x).
setup.shdetects the interpreter on pfSense and rewrites the forwarder's shebang to match, so the commands in this guide use/usr/local/bin/python3generically.maxminddb(for GeoIP) comes with the Suricata/pfBlockerNG packages; no pip install is needed, and the forwarder runs without GeoIP if the module is missing.
setup.sh installs four pieces on pfSense:
-
Python forwarder —
/usr/local/bin/forward-suricata-eve.py. Tails every/var/log/suricata/suricata_*/eve.json, enriches with GeoIP, sends events to Logstash over UDP. -
rc.d service —
/usr/local/etc/rc.d/suricata_forwarder.sh. Starts the forwarder at boot underdaemon(8)with a pidfile in/var/run/suricata_forwarder.pidand stdout/stderr in/var/log/suricata-forwarder.log. pfSense only auto-starts rc.d scripts whose name ends in.sh, hence the suffix. Control it withservice suricata_forwarder.sh start|stop|restart|status. -
Watchdog —
/usr/local/bin/suricata-forwarder-watchdog.sh. Checks whether the forwarder process exists and restarts the service if it is gone. -
Cron entry — a job in the pfSense Cron package (Services > Cron, stored in
config.xml; pfSense writes it to/etc/crontab). Runs the watchdog every minute.setup.shadds it withscripts/pfsense-add-watchdog-cron.php.
- Multi-interface support: monitors ALL Suricata instances automatically
- GeoIP enrichment: adds country/city data using maxminddb (no pip install needed)
- Auto-restart: rc.d service at boot, watchdog every minute
- Low overhead: usually well under 5% CPU
Only config.xml is guaranteed to survive a pfSense reinstall or configuration restore.
The files above live outside config.xml: they normally survive a reboot and an in-place
upgrade, but they are not part of pfSense backups and can be removed by an upgrade or a
package reinstall. The watchdog's Cron-package entry is in config.xml, so it survives.
Do not edit /etc/crontab directly — pfSense regenerates that file; add jobs in
Services > Cron instead.
After upgrading pfSense, re-run ./setup.sh --forwarder-only and then ./scripts/status.sh. Details in
the pfSense Upgrade Guide.
From the workstation or SIEM server where you cloned the repository:
cp config.env.example config.env # set SIEM_HOST, PFSENSE_HOST, PFSENSE_USER
./scripts/preflight.sh # SSH, Python on pfSense, OpenSearch, GeoIP
./setup.sh # runs preflight again, then deploys everythingsetup.sh bakes SIEM_HOST and LOGSTASH_UDP_PORT from config.env into the copy of the
forwarder it uploads, so no editing on pfSense is required. Verify:
ssh admin@<PFSENSE_IP> 'service suricata_forwarder.sh status'
ssh admin@<PFSENSE_IP> 'grep suricata-forwarder-watchdog /etc/crontab'
./scripts/status.shThe forwarder reads configuration from environment variables with defaults that setup.sh
replaces at deploy time:
| Variable | Default | Description |
|---|---|---|
SIEM_HOST |
value of SIEM_HOST in config.env |
SIEM/Logstash server IP |
LOGSTASH_UDP_PORT |
5140 |
UDP port for Logstash |
DEBUG_ENABLED |
False |
Enable debug logging |
DEBUG_LOG |
/var/log/suricata_forwarder_debug.log |
Debug log path |
To change the SIEM server:
Option 1: Edit config.env and re-run ./setup.sh (recommended, persistent)
Option 2: Edit the script on pfSense (persistent until the next setup.sh)
ssh admin@<PFSENSE_IP>
vi /usr/local/bin/forward-suricata-eve.py
# Change: SIEM_HOST = os.getenv("SIEM_HOST", "<SIEM_IP>")
service suricata_forwarder.sh restartOption 3: Environment variable for a one-off test run (stop the service first so two copies do not run)
ssh admin@<PFSENSE_IP>
service suricata_forwarder.sh stop
SIEM_HOST=198.51.100.20 /usr/local/bin/python3 /usr/local/bin/forward-suricata-eve.py
# Ctrl+C when done, then:
service suricata_forwarder.sh startThe forwarder searches for a GeoLite2 database in this order and uses the first that exists:
-
/usr/local/share/ntopng/GeoLite2-City.mmdb(ntopng — best for geomaps) /usr/local/share/suricata/GeoLite2/GeoLite2-City.mmdb/usr/local/share/suricata/GeoLite2/GeoLite2-Country.mmdb-
/usr/local/share/GeoIP/GeoLite2-City.mmdb(pfBlockerNG) -
/usr/local/share/GeoIP/GeoLite2-Country.mmdb(pfBlockerNG) /var/unbound/usr/local/share/GeoIP/GeoLite2-City.mmdb/var/unbound/usr/local/share/GeoIP/GeoLite2-Country.mmdb/var/db/GeoIP/GeoLite2-City.mmdb/usr/share/GeoIP/GeoLite2-City.mmdb
Country vs City database:
- Country: provides country_code, country_name, continent_code
- City: also provides city_name, region_name, latitude/longitude (required for geomap panels)
The forwarder needs no MaxMind account; the package that downloads the database (ntopng or pfBlockerNG) needs a free license key. See GeoIP Setup.
Use this only if you cannot run setup.sh (for example, no SSH from the SIEM host to
pfSense). Replace <SIEM_IP> with your SIEM server IP. All commands run on pfSense
after ssh admin@<PFSENSE_IP> unless noted.
From your workstation:
scp scripts/forward-suricata-eve.py admin@<PFSENSE_IP>:/usr/local/bin/
scp scripts/suricata-forwarder-watchdog.sh admin@<PFSENSE_IP>:/usr/local/bin/
ssh admin@<PFSENSE_IP> 'chmod +x /usr/local/bin/forward-suricata-eve.py /usr/local/bin/suricata-forwarder-watchdog.sh'On pfSense, set the SIEM address and make sure the shebang matches the installed interpreter:
sed -i '' 's/"SIEM_HOST", "[^"]*"/"SIEM_HOST", "<SIEM_IP>"/' /usr/local/bin/forward-suricata-eve.py
PY=$(for p in /usr/local/bin/python3 /usr/local/bin/python3.13 /usr/local/bin/python3.12 /usr/local/bin/python3.11 /usr/bin/python3; do [ -x "$p" ] && echo "$p" && break; done)
sed -i '' "1s|^#!.*|#!${PY}|" /usr/local/bin/forward-suricata-eve.pysetup.sh generates the service script; the simplest manual route is to copy it from a host
where setup.sh has already run, or write it yourself with these properties:
- Path
/usr/local/etc/rc.d/suricata_forwarder.sh(mode 755; the.shsuffix is required for pfSense to run it at boot) -
name="suricata_forwarder",rcvar="suricata_forwarder_enable" - Starts
/usr/local/bin/forward-suricata-eve.pyvia/usr/sbin/daemon -f -p /var/run/suricata_forwarder.pid -o /var/log/suricata-forwarder.log -
stopkills the pid in the pidfile;statusreports on it
Then enable and start it:
sysrc suricata_forwarder_enable=YES
service suricata_forwarder.sh start
service suricata_forwarder.sh status
grep suricata-forwarder /var/log/system.log | tail -5Expected syslog lines:
suricata-forwarder: Loaded GeoIP from /usr/local/share/ntopng/GeoLite2-City.mmdb
suricata-forwarder: Starting forwarder for 13 interface(s) to <SIEM_IP>:5140 (GeoIP: enabled)
Add the job through the Cron package (Services > Cron: every minute, user root,
command /usr/local/bin/suricata-forwarder-watchdog.sh). It is stored in config.xml, so
it survives upgrades, backups and restores. Do not use root's own crontab (crontab -) or
/etc/crontab: the first was empty on a live box after an upgrade, the second is
regenerated by pfSense. Scripted form (what setup.sh runs):
ssh admin@<PFSENSE_IP> php < scripts/pfsense-add-watchdog-cron.php # prints "added" or "present"
grep suricata-forwarder-watchdog /etc/crontab # run on pfSense# On pfSense
service suricata_forwarder.sh status
pgrep -fl forward-suricata-eve
# Recent forwarder messages
grep suricata-forwarder /var/log/system.log | tail -10
# Watchdog activity (only logs when it has to restart something)
grep suricata-watchdog /var/log/system.log | tail -5# Stop the service so the watchdog does not start a second copy alongside your debug run
service suricata_forwarder.sh stop
# Run in the foreground with debug logging (Ctrl+C to stop)
DEBUG_ENABLED=true /usr/local/bin/python3 /usr/local/bin/forward-suricata-eve.py &
tail -f /var/log/suricata_forwarder_debug.log
# When finished
pkill -f forward-suricata-eve.py
service suricata_forwarder.sh startDebug output shows:
- GeoIP database loaded
- Each interface being monitored
- IPs being enriched with country codes
- Event counts per interface
On your SIEM server:
# Check event count (should be increasing)
curl -s http://localhost:9200/suricata-*/_count | jq .count
# Check latest events
curl -s "http://localhost:9200/suricata-*/_search?size=3&sort=@timestamp:desc" | jq -r '.hits.hits[] | ._source | {timestamp: ."@timestamp", event_type: .event_type, src_ip: .src_ip}'
# Monitor real-time (press Ctrl+C to stop)
watch -n 2 'curl -s http://localhost:9200/suricata-*/_count | jq .count'Expected output — event count should increase every few seconds:
{
"timestamp": "2026-09-19T17:38:24.348Z",
"event_type": "tls",
"src_ip": "203.0.113.45"
}
Generate test traffic on pfSense:
# From pfSense, generate DNS query
nslookup google.com
# From pfSense, generate HTTPS connection
fetch -o /dev/null https://www.pfsense.org
# Wait 5 seconds
sleep 5
# Check SIEM for new events
curl -s "http://<SIEM_IP>:9200/suricata-*/_search?size=1&sort=@timestamp:desc" | jq '.hits.hits[0]._source.event_type'# Check the interpreter the shebang points at exists
head -1 /usr/local/bin/forward-suricata-eve.py
ls -l /usr/local/bin/python3*
# Run it in the foreground to see errors
service suricata_forwarder.sh stop
/usr/local/bin/forward-suricata-eve.py
# Check service log and permissions
tail -20 /var/log/suricata-forwarder.log
ls -la /usr/local/bin/forward-suricata-eve.py /usr/local/etc/rc.d/suricata_forwarder.sh# 1. Check if Suricata is generating events (the number is instance-specific)
tail -f /var/log/suricata/suricata_igc012345/eve.json
# 2. Check if forwarder is actually running
service suricata_forwarder.sh status
# 3. Test UDP connectivity from pfSense to SIEM
echo '{"test":"event"}' | nc -u -w1 <SIEM_IP> 5140
# 4. Check SIEM received test event
curl -s "http://<SIEM_IP>:9200/suricata-*/_search?size=1&sort=@timestamp:desc" | jqThe forwarder preserves Suricata's original timestamp. Check pfSense timezone:
# On pfSense
date
# Suricata timestamps include timezone offset
tail -1 /var/log/suricata/suricata_igc012345/eve.json | jq .timestampThe forwarder should use a few percent CPU at most. If higher:
# Check process stats
ps aux | grep forward-suricata-eve.py
# Check if Suricata is generating too many events
wc -l /var/log/suricata/suricata_*/eve.json
# Check network connectivity issues
netstat -s -p udp# Check the watchdog job (Cron package)
grep suricata-forwarder-watchdog /etc/crontab
# Run watchdog manually to test
/usr/local/bin/suricata-forwarder-watchdog.sh
# Check syslog for watchdog output
grep suricata-watchdog /var/log/system.log | tail -20If the entry is missing after a pfSense upgrade, re-run ./setup.sh.
ssh admin@<PFSENSE_IP> 'service suricata_forwarder.sh restart'If you kill the process instead (pkill -f forward-suricata-eve.py), the watchdog restarts
it within a minute.
Edit config.env and re-run ./setup.sh; it uploads a fresh copy of the forwarder and
restarts the service. To change only the script on pfSense:
vi /usr/local/bin/forward-suricata-eve.py
service suricata_forwarder.sh restart# Check forwarder resource usage
ps aux | grep forward-suricata-eve.py
# Check UDP statistics
netstat -s -p udp
# Watchdog restarts (frequent entries mean the forwarder is crashing)
grep suricata-watchdog /var/log/system.log | tail -20For deeper monitoring (alerting on forwarder silence, unified watchdog) see Suricata Forwarder Monitoring.
| File | Location on pfSense | Purpose |
|---|---|---|
forward-suricata-eve.py |
/usr/local/bin/ |
Main forwarder (Python) |
suricata_forwarder.sh |
/usr/local/etc/rc.d/ |
rc.d service; starts at boot, service suricata_forwarder.sh ...
|
suricata-forwarder-watchdog.sh |
/usr/local/bin/ |
Restarts the forwarder if the process is gone |
Cron job (* * * * *) |
Cron package (config.xml, written to /etc/crontab) |
Runs the watchdog every minute |
suricata_forwarder.pid |
/var/run/ |
Pidfile written by the rc.d service |
suricata-forwarder.log |
/var/log/ |
stdout/stderr of the daemonized forwarder |
suricata_forwarder_debug.log |
/var/log/ |
Debug log (only with DEBUG_ENABLED=true) |
None of these are in config.xml; re-run ./setup.sh after a pfSense upgrade or reinstall.
Continue to:
- Dashboard Installation - Set up Grafana dashboards
- GeoIP Setup - Get the attack map working
- Troubleshooting Guide - Common issues and solutions
The original approach used shell scripts with tail | while read | nc but this was
fundamentally broken on pfSense:
- Shell while-read loops have buffering issues
- Pipe chaining corrupts data
- Manual tests worked but automated scripts failed
- Events arrived as single "X" characters
The Python solution:
- ✅ Single reliable process
- ✅ No pipe/buffer issues
- ✅ Proper error handling
- ✅ Uses the Python already on pfSense
- ✅ Easy to debug and maintain
Source: docs/install/INSTALL_PFSENSE_FORWARDER.md. This wiki is generated from the repository on every push to main; edit the source file and open a pull request rather than editing the wiki page.
This wiki is generated from the Markdown files in pfsense-siem-stack on every push to main. Edits made here are overwritten; edit the source file named at the bottom of each page and open a pull request. Placeholders used throughout: admin@<PFSENSE_IP> is your pfSense SSH login, <SIEM_IP> your SIEM server, interface names like igc0 are examples. Licensed MPL 2.0.
Getting started
Suricata
pfBlockerNG
Telegraf
pfSense platform
- Upgrading pfSense ⭐
- Filterlog Stops After Rotation
- Traffic Shaping Guide
- Shaping Optimization Notes
- October 2026 Tuning Results
- CrowdSec (exploratory)
SIEM: deploy
- Quick Start
- New User Checklist
- SIEM Server Installation
- Forwarder Installation
- GeoIP Setup
- Dashboard Installation
SIEM: operate
- Management Console
- Forwarder Operations and Watchdog
- Multi-Interface and Retention
- Scripts Reference
SIEM: fix