Added vulnerability scan data retention (#9612)

This commit is contained in:
Matteo Biscosi 2025-11-19 13:10:55 +01:00
parent 7ddcf45bcb
commit f1de8c76a3
5 changed files with 31 additions and 0 deletions

View file

@ -4,6 +4,7 @@
local DEFAULT_DATA_RETENTION_DAYS = 30
local DEFAULT_AGGREGATED_ASN_DATA_RETENTION_DAYS = 60
local DEFAULT_AGGREGATED_FLOWS_DATA_RETENTION_DAYS = 60
local DEFAULT_VS_REPORTS_DATA_RETENTION_DAYS = 30
local DEFAULT_DATA_RETENTION_DAYS_KEY = "ntopng.prefs.data_retention_days"
local FLOWS_AND_ALERTS_DATA_RETENTION_DAYS_KEY =
"ntopng.prefs.flows_and_alerts_data_retention_days"
@ -11,6 +12,8 @@ local AGGREGATED_FLOWS_DATA_RETENTION_DAYS_KEY =
"ntopng.prefs.aggregated_flows_data_retention_days"
local AGGREGATED_ASN_DATA_RETENTION_DAYS_KEY =
"ntopng.prefs.aggregated_asn_data_retention_days"
local VS_REPORT_RETENTION_DAYS_KEY =
"ntopng.prefs.vs_reports_retention_days"
local TS_AND_STATS_DATA_RETENTION_DAYS_KEY =
"ntopng.prefs.ts_and_stats_data_retention_days"
@ -36,6 +39,12 @@ end
-- ########################################################
function data_retention_utils.getAggregatedVSReportRetention()
return DEFAULT_VS_REPORTS_DATA_RETENTION_DAYS
end
-- ########################################################
function data_retention_utils.getFlowsAndAlertsDataRetentionDays()
local data_retention = ntop.getCache(
FLOWS_AND_ALERTS_DATA_RETENTION_DAYS_KEY) or
@ -66,6 +75,14 @@ end
-- ########################################################
function data_retention_utils.getVSReportRetentionDays()
local data_retention = ntop.getCache(VS_REPORT_RETENTION_DAYS_KEY)
return tonumber(data_retention) or
(data_retention_utils.getAggregatedVSReportRetention())
end
-- ########################################################
function data_retention_utils.getTSAndStatsDataRetentionDays()
local data_retention =
ntop.getCache(TS_AND_STATS_DATA_RETENTION_DAYS_KEY) or