Skip to content

Filterlog Stops After Rotation

github-actions[bot] edited this page Oct 3, 2026 · 1 revision

This is a pfSense issue, not a SIEM-stack one, but it takes out two of the data sources this stack relies on. It is worth fixing on every pfSense box that feeds Grafana, whether or not you use pfBlockerNG.

Symptom

  • /var/log/filter.log stops growing. Often the only line in it is newsyslog's logfile turned over message.
  • pfBlockerNG's /var/log/pfblockerng/ip_block.log also stops, because pfBlockerNG derives its block log from filter.log.
  • Grafana: pfBlockerNG panels and the firewall-log panels in pfsense_pfblockerng_system.json go to "No data" while everything else keeps working.
  • Rules are still enforced; only the logging has stopped.
  • ./scripts/status.sh reports Filter.log freshness... Stale and/or Filterlog file handle... No file handle.

Quick check from the SIEM server:

ssh admin@<PFSENSE_IP> 'wc -l /var/log/filter.log; ls -l /var/log/filter.log; date'
# 1 line, or an mtime well in the past while traffic is flowing -> you have this problem

ssh admin@<PFSENSE_IP> 'lsof -p $(pgrep filterlog) | grep filter.log'
# No output -> filterlog has no open handle on the live file

Cause

pfSense's filterlog daemon receives pf log records and writes them to /var/log/filter.log via syslogd. When newsyslog rotates the file (default trigger: 500 KB), the daemon does not reliably reopen the new file and keeps writing into the rotated-away handle, or into nothing. The condition persists until filterlog/syslogd is restarted.

Observed on pfSense CE 2.7.x through 2.8.1 (tracked upstream as pfSense bug #8555). Re-check after upgrading to 2.9.0; if the cron job below never fires on the new release, you can remove it.

How often it bites depends on how quickly filter.log reaches the rotation size. A busy firewall with logging on the default-deny rule can rotate every couple of hours.

Immediate fix

Any of these gets logging back within seconds. Use the first one.

SSH (fastest):

ssh admin@<PFSENSE_IP>
php -r 'require_once("/etc/inc/filter.inc"); filter_configure(); system_syslogd_start();'
# pfBlockerNG installed? also re-sync its logging:
php -r 'require_once("/usr/local/pkg/pfblockerng/pfblockerng.inc"); pfblockerng_sync_on_changes();'

tail -f /var/log/filter.log      # live entries should appear

Web GUI: Diagnostics > Command Prompt > Execute Shell Command, paste the same php -r ... line(s), Execute.

Reboot: Diagnostics > Reboot. Works, but is the slowest option.

Reduce how often it happens (optional, GUI)

Status > System Logs > Settings:

  • Log Rotation Size (KB): raise from 500 to 2000 or 5000. Fewer rotations means fewer chances to hit the bug. This applies to every log pfSense rotates, not only filter.log.
  • Log Rotation Count: how many rotated copies to keep; does not affect the bug, only disk use.

This is mitigation, not a fix. Install the cron job below regardless.

Permanent fix: pfSense Cron package job

Run a small check every 10 minutes on pfSense that restarts filterlog only when filter.log has gone stale. Doing it through the pfSense Cron package (rather than crontab -e) matters: Cron-package jobs are stored in config.xml, so they are included in pfSense backups and survive upgrades, reinstalls and config restores. A hand-edited /etc/crontab is regenerated by pfSense and your line disappears.

1. Install the Cron package (once)

System > Package Manager > Available Packages > search cron > Install.

2. Add the job

Services > Cron > Add:

Field Value
Minute */10
Hour *
Day of Month *
Month *
Day of Week *
User root
Command see below
Description Restart filterlog if filter.log is stale

Command (single line):

/usr/bin/find /var/log/filter.log -mmin +10 -exec sh -c 'php -r "require_once(\"/etc/inc/filter.inc\"); filter_configure(); system_syslogd_start();" && php -r "require_once(\"/usr/local/pkg/pfblockerng/pfblockerng.inc\"); pfblockerng_sync_on_changes();"' \; 2>&1 | logger -t filterlog-monitor

Without pfBlockerNG, drop the second php -r (everything from && to the closing "):

/usr/bin/find /var/log/filter.log -mmin +10 -exec sh -c 'php -r "require_once(\"/etc/inc/filter.inc\"); filter_configure(); system_syslogd_start();"' \; 2>&1 | logger -t filterlog-monitor

Save. The job is live immediately.

What it does: find -mmin +10 matches filter.log only if it has not been modified in the last 10 minutes; when it matches, the -exec restarts filter/syslogd (and pfBlockerNG logging), and anything printed is tagged filterlog-monitor in /var/log/system.log. When filter.log is fresh, find matches nothing and the job exits silently.

Tuning: on a very quiet network 10 minutes without a logged packet can be normal, and the job will restart filterlog needlessly (harmless, but noisy). Raise -mmin +10 to +30 and the schedule to */30 if you see restarts with nothing wrong. On a busy network you can tighten both to 5.

Alternative: unconditional restart every few hours

If you prefer brute force, a Cron-package job with Minute 5, Hour */4, User root and this command restarts filterlog every four hours regardless of state:

php -r 'require_once("/etc/inc/filter.inc"); filter_configure(); system_syslogd_start();' 2>&1 | logger -t filterlog-restart

The conditional job above is preferred because it also bounds the outage to 10 minutes.

Verification

The job is installed. The Cron package renders its config.xml entries into /etc/crontab (that is why you never edit that file by hand):

ssh admin@<PFSENSE_IP> 'grep filterlog /etc/crontab'

Simulate the failure and watch it recover:

ssh admin@<PFSENSE_IP>
pkill -9 filterlog                  # nothing will be written to filter.log from here
# wait up to 10 minutes for the cron run, then:
grep filterlog-monitor /var/log/system.log | tail -5
tail -5 /var/log/filter.log         # fresh entries again

Or run the command by hand with -mmin +0 so it fires regardless of age:

/usr/bin/find /var/log/filter.log -mmin +0 -exec sh -c 'php -r "require_once(\"/etc/inc/filter.inc\"); filter_configure(); system_syslogd_start();"' \;
tail -5 /var/log/filter.log

Check pfBlockerNG data is reaching OpenSearch again (from the SIEM server):

curl -s "http://<SIEM_IP>:9200/pfblockerng-*/_count" -H 'Content-Type: application/json' \
  -d '{"query":{"range":{"@timestamp":{"gte":"now-1h"}}}}' | jq .count

pfBlockerNG events arrive via Telegraf's [[outputs.opensearch]], so a count of 0 here after filterlog is confirmed healthy points at Telegraf instead. See TELEGRAF_ON_PFSENSE.md, which also covers the separate pfBlockerNG log-permissions problem that can starve Telegraf even when filterlog is fine.

How status.sh detects it

./scripts/status.sh already includes a pfSense Filterlog Health section (no changes needed on your side). Over SSH it:

  1. reads stat -f %m /var/log/filter.log and flags the file Stale if it is older than 600 seconds, printing the one-line php -r fix;
  2. runs lsof -p $(pgrep filterlog) and flags No file handle if filterlog has no descriptor on filter.log.

Either failure counts toward the script's non-zero exit code, so running status.sh from a SIEM-side cron or from the pfsense-siem console (option 5) gives you visibility, while the pfSense Cron-package job above does the actual remediation.

Related


Source: docs/troubleshooting/PFSENSE_FILTERLOG_ROTATION_FIX.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.

Clone this wiki locally