Skip to content

hs/cache: cleaner and more detailed output v3#14900

Closed
lukashino wants to merge 1 commit intoOISF:mainfrom
lukashino:feat/8322-pruning-stats-detailed-v3
Closed

hs/cache: cleaner and more detailed output v3#14900
lukashino wants to merge 1 commit intoOISF:mainfrom
lukashino:feat/8322-pruning-stats-detailed-v3

Conversation

@lukashino
Copy link
Contributor

@lukashino lukashino commented Feb 24, 2026

Follow-up of #14898

Redmine ticket: https://redmine.openinfosecfoundation.org/issues/8322

Reduce the logging level of a minor informational message.

Split tracking of pruning by age and by version, and log those separately, where the logging only appears if something has been removed.

This should be part of 8.0.x backport.

Describe changes:
v3:

  • added a Redmine ticket for tracking

v2:

  • addressed my feedback

Reduce logging level of a minor informational message.

Split tracking of pruning by age and by version and log those
separately, where the logging only appears if something has been
removed.

Ticket: 8322
Copilot AI review requested due to automatic review settings February 24, 2026 21:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines the Hyperscan cache logging to provide clearer, more detailed output about cache pruning operations. It reduces the logging level for a minor informational message and splits the tracking of cache removals into separate counters for age-based and version-based pruning.

Changes:

  • Changed cache statistics logging from SCLogInfo to SCLogPerf for better log level categorization
  • Split single hs_dbs_cache_pruned_cnt counter into separate counters for age-based and version-based pruning
  • Separated pruning log messages so each removal reason is reported independently when applicable

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/util-mpm-hs-core.h Replaced single pruned counter with separate counters for age-based and version-based cache removals
src/util-mpm-hs-cache.c Updated pruning logic to track removals separately and split log messages by removal reason
Comments suppressed due to low confidence (1)

src/util-mpm-hs-cache.c:471

  • Both log messages use the same denominator hs_dbs_cache_pruned_considered_cnt which represents the total files considered, not just those removed. This could be misleading when both age and version removals occur. For example, if 100 files were considered, 30 removed by age and 20 by version, the logs would show '30/100' and '20/100', which might incorrectly suggest 50 total removals when it could be 50, or the counts could overlap. Consider either using the sum of both removal counts as the denominator, or clarifying in the message that the denominator represents files considered rather than files removed.
        if (pd_cache_stats->hs_dbs_cache_pruned_by_version_cnt) {
            SCLogInfo("rule group cache pruning removed %u/%u of HS caches due to "
                      "version-incompatibility (not v%s)",
                    pd_cache_stats->hs_dbs_cache_pruned_by_version_cnt,
                    pd_cache_stats->hs_dbs_cache_pruned_considered_cnt, HS_CACHE_FILE_VERSION);
        }
        if (pd_cache_stats->hs_dbs_cache_pruned_by_age_cnt) {
            SCLogInfo("rule group cache pruning removed %u/%u of HS caches due to "
                      "age (older than %s)",
                    pd_cache_stats->hs_dbs_cache_pruned_by_age_cnt,
                    pd_cache_stats->hs_dbs_cache_pruned_considered_cnt, time_str);
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 16.66667% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.23%. Comparing base (ccd1df9) to head (5e1742d).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14900      +/-   ##
==========================================
- Coverage   73.26%   73.23%   -0.03%     
==========================================
  Files         993      993              
  Lines      271862   271870       +8     
  Branches    48276    48280       +4     
==========================================
- Hits       199177   199116      -61     
- Misses      47279    47338      +59     
- Partials    25406    25416      +10     
Flag Coverage Δ
fuzzcorpus 57.09% <ø> (ø)
livemode 15.42% <ø> (-0.02%) ⬇️
netns 15.47% <ø> (-0.02%) ⬇️
pcap 40.81% <ø> (-0.07%) ⬇️
suricata-verify 58.48% <ø> (+<0.01%) ⬆️
unittests 50.25% <16.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline = 29877

@victorjulien
Copy link
Member

Merged in #14906, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants