From bf60406e82bb7f4fdbda1fab2a14d4deb0909f6c Mon Sep 17 00:00:00 2001 From: Alfredo Cardigliano Date: Tue, 12 Apr 2022 17:13:01 +0200 Subject: [PATCH] Add records count in top l7 contacts --- scripts/historical/tables/top_l7_contacts.json | 6 ++++++ scripts/locales/en.lua | 3 +++ scripts/lua/modules/lua_utils.lua | 2 +- scripts/lua/modules/tag_utils.lua | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/historical/tables/top_l7_contacts.json b/scripts/historical/tables/top_l7_contacts.json index 0dd06584b1..9971ad9eec 100644 --- a/scripts/historical/tables/top_l7_contacts.json +++ b/scripts/historical/tables/top_l7_contacts.json @@ -42,6 +42,12 @@ { "name" : "L7_PROTO_MASTER" }, + { + "name" : "number", + "func" : "COUNT", + "param" : "*", + "value_type" : "number" + }, { "name" : "bytes", "func" : "SUM", diff --git a/scripts/locales/en.lua b/scripts/locales/en.lua index b7cb81570f..b2e8a1c583 100644 --- a/scripts/locales/en.lua +++ b/scripts/locales/en.lua @@ -1517,6 +1517,7 @@ local lang = { ["l7proto"] = "Application", ["last_seen"] = "End", ["max_results"] = "Max Results", + ["number"] = "Number", ["observation_point_id"] = "Obs. Point ID", ["packets"] = "Pkts", ["probe_ip"] = "Flow Exporter", @@ -1524,6 +1525,7 @@ local lang = { ["query"] = "Query", ["query_copied"] = "Query SQL copied to clipboard!", ["query_performed"] = "Query performed in", + ["records"] = "Records", ["run_query"] = "Run query", ["select_note"] = "Use * for all fields or a comma-separated list of fields (,,...)", ["server"] = "Server", @@ -1572,6 +1574,7 @@ local lang = { ["name"] = "Hostname", ["network"] = "Network", ["network_name"] = "Network Name", + ["number"] = "Number", ["observation_point_id"] = "Observation Point ID", ["output_snmp"] = "Output SNMP Interface", ["packets"] = "Packets", diff --git a/scripts/lua/modules/lua_utils.lua b/scripts/lua/modules/lua_utils.lua index 5715ebce75..a3bf43985d 100644 --- a/scripts/lua/modules/lua_utils.lua +++ b/scripts/lua/modules/lua_utils.lua @@ -47,7 +47,7 @@ bitsToSizeMultiplier = format_utils.bitsToSizeMultiplier -- Note: Regexs are applied by default. Pass plain=true to disable them. function string.contains(str, start, is_plain) - if type(str) ~= 'string' or type(start) ~= 'string' then + if type(str) ~= 'string' or type(start) ~= 'string' or isEmptyString(str) or isEmptyString(start) then return false end diff --git a/scripts/lua/modules/tag_utils.lua b/scripts/lua/modules/tag_utils.lua index 5b755f7e0a..96e5dfc2d2 100644 --- a/scripts/lua/modules/tag_utils.lua +++ b/scripts/lua/modules/tag_utils.lua @@ -276,6 +276,11 @@ tag_utils.defined_tags = { i18n_label = i18n('db_search.tags.bytes'), operators = {'eq', 'neq', 'lt', 'gt', 'gte', 'lte'} }, + number = { + value_type = 'number', + i18n_label = i18n('db_search.tags.number'), + operators = {'eq', 'neq', 'lt', 'gt', 'gte', 'lte'} + }, packets = { value_type = 'packets', i18n_label = i18n('db_search.tags.packets'),