| Summary: | Suricata Hyperscan cache grows indefinitely with no automatic pruning | ||
|---|---|---|---|
| Product: | IPFire | Reporter: | Adam G <ag> |
| Component: | --- | Assignee: | Stefan Schantl <stefan.schantl> |
| Status: | ON_QA --- | QA Contact: | |
| Severity: | Minor Usability | ||
| Priority: | - Unknown - | CC: | adolf.belka, michael.tremer, stefan.schantl |
| Version: | 2 | ||
| Hardware: | all | ||
| OS: | Unspecified | ||
|
Description
Adam G
2026-01-14 13:30:50 UTC
checked on my device (PC Engines - apu4): The directory contained 6786 files - 6,14 GB. Deleting the files reduced disk usage from 75% to 25%. (In reply to Adam G from comment #0) > Upstream Suricata is aware and working on a fix: > Open PR implementing pruning based on file mtime and configurable max age: > https://github.com/OISF/suricata/pull/14590 (created 11 Jan 2026, still open > with requested changes). PR #14590 was closed on Jan 14th and PR #14617 opened PR #14617 was closed on Jan 16th and PR #14630 opened PR #14630 was merged on Jan 16th. So a final version of the pruni9ng process was reviewed and agreed by the suricata devs and has been merged into their main branch. Not sure when this will now get into a release, but it has been merged into their main branch so the next release should make it available. Finally a fix has been landed and merged in the suricata git. https://github.com/OISF/suricata/pull/14630 I've grabbed those patches, merged them to a single patchfile and applied them to the suricata 8.0.3 source code. https://git.ipfire.org/?p=people/stevee/ipfire-2.x.git;a=commit;h=a11efb0cc3c4e873be47f2b364ff9ab417ae2b93 (In reply to Stefan Schantl from comment #3) > Finally a fix has been landed and merged in the suricata git. > > https://github.com/OISF/suricata/pull/14630 > > I've grabbed those patches, merged them to a single patchfile and applied > them to the suricata 8.0.3 source code. > > https://git.ipfire.org/?p=people/stevee/ipfire-2.x.git;a=commit; > h=a11efb0cc3c4e873be47f2b364ff9ab417ae2b93 Could you please post this to the list? I've sent the patchset to the development mailing list. https://lists.ipfire.org/development/20260123053102.389490-1-stefan.schantl@ipfire.org/T/#u The patched binary seems to work well. All old cache files have been deleted during first startup. Thank you. Merged. I've tested this patchset on the latest x86_64 nightly (139af25a) and I can confirm the SGH directory has reduced in size: Before update: # du -sh /var/cache/suricata/sgh/ 3.6G /var/cache/suricata/sgh/ After update and reboot: # du -sh /var/cache/suricata/sgh/ 55M /var/cache/suricata/sgh/ After a few more days the cache has increased further: # du -sh /var/cache/suricata/sgh/ 546M /var/cache/suricata/sgh/ The default cache retention is set to 7 days in `/etc/suricata/suricata.yaml`: ``` sgh-mpm-caching: yes sgh-mpm-caching-max-age: 7d sgh-mpm-caching-path: /var/cache/suricata/sgh ``` Suricata logs this correctly as nothing cached is older than 7 days yet: ``` 22:30:57 suricata: [8258] <Info> -- Rule group caching - loaded: 66 newly cached: 0 total cacheable: 66 22:30:57 suricata: [8258] <Info> -- Rule group cache pruning removed 0/555 of HS caches due to version-incompatibility (not v2) or age (older than 2026-01-20 22:30:57) ``` I just tested my vm with update from CU199 to CU200 Testing. sgh was 59M with CU199 and after updating to CU200 sgh was 16M So the pruning is confirmed for me on my vm system. |