hs/cache: cleaner and more detailed output v3#14900
hs/cache: cleaner and more detailed output v3#14900
Conversation
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
There was a problem hiding this comment.
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
SCLogInfotoSCLogPerffor better log level categorization - Split single
hs_dbs_cache_pruned_cntcounter 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_cntwhich 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 Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Information: QA ran without warnings. Pipeline = 29877 |
|
Merged in #14906, thanks! |
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:
v2: