Major code rework to fully use the clickhouse API in place of Mysql

This commit is contained in:
Alfredo Cardigliano 2025-06-09 15:33:57 +02:00
parent effde04657
commit 6f9d7cd14f
14 changed files with 17 additions and 70 deletions

View file

@ -1208,31 +1208,6 @@ function alert_store:select_historical(filter, fields, download --[[ Available o
-- res = interface.alert_store_query(q, true)
res = interface.alert_store_query(q, true, true) -- Limit results to the max set in the backend
if ntop.isClickHouseEnabled() and not prefs.native_clickhouse_client_enabled then
-- convert DATETIME to epoch
for _, record in ipairs(res or {}) do
if record.tstamp_epoch then
record.tstamp = record.tstamp_epoch
elseif record.tstamp then
record.tstamp = format_utils.parseDateTime(record.tstamp)
end
if record.tstamp_end_epoch then
record.tstamp_end = record.tstamp_end_epoch
elseif record.tstamp_end then
record.tstamp_end = format_utils.parseDateTime(record.tstamp_end)
end
-- first_seen is only used in where conditions as it is indexed,
-- using tstamp in select as it is commong to all alert tables
-- if record.first_seen then record.first_seen = format_utils.parseDateTime(record.first_seen) end
if record.user_label_tstamp then
record.user_label_tstamp = format_utils.parseDateTime(record.user_label_tstamp)
end
end
end
-- count records
local count_res = 0
if isEmptyString(group_by_clause) then

View file

@ -2302,7 +2302,6 @@ local known_parameters = {
["toggle_fingerprint_stats"] = validateBool,
["toggle_starttls"] = validateBool,
["toggle_dump_pcap_to_clickhouse"] = validateBool,
["toggle_use_native_clickhouse_client"] = validateBool,
["toggle_query_performance_log"] = validateBool,
["behaviour_analysis_learning_period"] = validateNumber,
["behaviour_analysis_learning_status_during_learning"] = validateNumber,

View file

@ -234,10 +234,6 @@ local menu_subpages = {{
title = i18n("prefs.toggle_dump_pcap_to_clickhouse_title"),
description = i18n("prefs.toggle_dump_pcap_to_clickhouse_description")
},
toggle_use_native_clickhouse_client = {
title = i18n("prefs.toggle_use_native_clickhouse_client_title"),
description = i18n("prefs.toggle_use_native_clickhouse_client_description")
},
toggle_query_performance_log = {
title = i18n("prefs.toggle_query_performance_log_title"),
description = i18n("prefs.toggle_query_performance_log_description")