diff --git a/http_src/vue/page-flow-historical.vue b/http_src/vue/page-flow-historical.vue index ee9d4f649e..dfc8bedd40 100644 --- a/http_src/vue/page-flow-historical.vue +++ b/http_src/vue/page-flow-historical.vue @@ -556,8 +556,8 @@ const map_table_def_columns = async (columns) => { "DURATION": (duration, row) => { return NtopUtils.secondsToTime(duration) }, - "THROUGHPUT": (throughput, row) => { - return FormatterUtils.getFormatter("bps_no_scale")(throughput); + "throughput": (throughput, row) => { + return throughput }, "l4proto": (value, row) => { let l4proto_string = DataTableRenders.filterize('l4proto', value.value, value.label) diff --git a/httpdocs/dist b/httpdocs/dist index 4d8353d6a5..dd09005c6f 160000 --- a/httpdocs/dist +++ b/httpdocs/dist @@ -1 +1 @@ -Subproject commit 4d8353d6a58283161f2578c7907a2e7a5fa341c0 +Subproject commit dd09005c6fe93528119be4cb1e6161845f1ee450 diff --git a/httpdocs/tables_config/flow_historical.json b/httpdocs/tables_config/flow_historical.json index 1d44884140..d3fb00d969 100644 --- a/httpdocs/tables_config/flow_historical.json +++ b/httpdocs/tables_config/flow_historical.json @@ -180,7 +180,7 @@ }, { "title_i18n": "db_search.throughput", - "data_field": "THROUGHPUT", + "data_field": "throughput", "sortable": true, "min-width": "100px", "style": "text-align:right;", diff --git a/scripts/lua/modules/historical_flow_utils.lua b/scripts/lua/modules/historical_flow_utils.lua index 3cf6fa60c0..71c3da67d7 100644 --- a/scripts/lua/modules/historical_flow_utils.lua +++ b/scripts/lua/modules/historical_flow_utils.lua @@ -735,7 +735,11 @@ end -- ##################################### local function dt_format_thpt(thpt) - return bitsToSize(tonumber(thpt) or 0) + if getThroughputType() == "bps" then + return bitsToSize(tonumber(thpt) or 0) + else + return pktsToSize(tonumber(thpt) or 0) + end end -- ##################################### @@ -1258,6 +1262,7 @@ local flow_columns = { ['IS_SRV_VICTIM'] = { tag = "is_srv_victim" }, ['IS_SRV_BLACKLISTED'] = { tag = "is_srv_blacklisted" }, ['PROTOCOL_INFO_JSON'] = { tag = "protocol_info_json", dt_func = historical_format_utils.parseInfoJson }, + ['THROUGHPUT'] = { tag = "throughput", dt_func = dt_format_thpt }, ['ALERT_JSON'] = { tag = "json" }, ['SRC_PROC_NAME'] = { tag = "cli_proc_name", db_type = "String", db_raw_type = "String" }, ['DST_PROC_NAME'] = { tag = "srv_proc_name", db_type = "String", db_raw_type = "String" }, @@ -1402,7 +1407,7 @@ historical_flow_utils.min_aggregated_flow_db_columns = { } historical_flow_utils.extra_db_columns = { - ["throughput"] = "ABS(LAST_SEEN - FIRST_SEEN) as TIME_DELTA, (TOTAL_BYTES / (TIME_DELTA + 1)) * 8 as THROUGHPUT", + ["throughput"] = "ABS(LAST_SEEN - FIRST_SEEN) as TIME_DELTA, (" .. ternary(getThroughputType() == "bps", "TOTAL_BYTES", "PACKETS") .. " / (TIME_DELTA + 1)) * 8 as THROUGHPUT", ["duration"] = "ABS(LAST_SEEN - FIRST_SEEN) as DURATION", ["protocol_info_json"] = "PROTOCOL_INFO_JSON", ["alert_json"] = "ALERT_JSON"