cn 23.07 ck session_record_cn新增common_server_fqdn字段
This commit is contained in:
32
CN发布版本更新记录/CN-23.07/clickhouse/update-23.07-ck.sql
Normal file
32
CN发布版本更新记录/CN-23.07/clickhouse/update-23.07-ck.sql
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
ALTER table cyber_narrator_galaxy.session_record_cn_local on cluster ck_cluster add column IF NOT EXISTS common_server_fqdn String after common_server_port;
|
||||||
|
ALTER table cyber_narrator_galaxy.session_record_cn on cluster ck_cluster add column IF NOT EXISTS common_server_fqdn String after common_server_port;
|
||||||
|
ALTER table cyber_narrator_galaxy.session_record_cn on cluster ck_query add column IF NOT EXISTS common_server_fqdn String after common_server_port;
|
||||||
|
|
||||||
|
|
||||||
|
drop view IF EXISTS cyber_narrator_galaxy.cn_entity_relation_view ON CLUSTER ck_cluster;
|
||||||
|
|
||||||
|
create MATERIALIZED VIEW if not exists cyber_narrator_galaxy.cn_entity_relation_view on cluster ck_cluster TO cyber_narrator_galaxy.cn_entity_relation_local
|
||||||
|
(
|
||||||
|
app_name String,
|
||||||
|
fqdn String,
|
||||||
|
ip String,
|
||||||
|
country String,
|
||||||
|
province String,
|
||||||
|
region String,
|
||||||
|
asn String,
|
||||||
|
create_time Int64,
|
||||||
|
update_time Int64
|
||||||
|
) AS
|
||||||
|
SELECT
|
||||||
|
common_app_label AS app_name,
|
||||||
|
common_server_fqdn AS fqdn,
|
||||||
|
common_server_ip AS ip,
|
||||||
|
anyLast(server_country) AS country,
|
||||||
|
anyLast(server_province) AS province,
|
||||||
|
anyLast(server_region) AS region,
|
||||||
|
anyLast(server_asn) AS asn,
|
||||||
|
min(c1.common_recv_time) AS create_time,
|
||||||
|
max(c1.common_recv_time) AS update_time
|
||||||
|
FROM cyber_narrator_galaxy.session_record_cn_local c1
|
||||||
|
where common_l4_protocol ='IPv4_TCP' OR common_server_port in(53,443)
|
||||||
|
GROUP BY ip,app_name,fqdn;
|
||||||
@@ -14,6 +14,7 @@ CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.session_record_cn_local ON CLUS
|
|||||||
common_server_ip String,
|
common_server_ip String,
|
||||||
common_client_port Int64,
|
common_client_port Int64,
|
||||||
common_server_port Int64,
|
common_server_port Int64,
|
||||||
|
common_server_fqdn String,
|
||||||
common_app_label String,
|
common_app_label String,
|
||||||
common_app_id String,
|
common_app_id String,
|
||||||
common_l4_protocol String,
|
common_l4_protocol String,
|
||||||
@@ -138,6 +139,7 @@ CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.session_record_cn ON CLUSTER ck
|
|||||||
common_server_ip String,
|
common_server_ip String,
|
||||||
common_client_port Int64,
|
common_client_port Int64,
|
||||||
common_server_port Int64,
|
common_server_port Int64,
|
||||||
|
common_server_fqdn String,
|
||||||
common_app_label String,
|
common_app_label String,
|
||||||
common_app_id String,
|
common_app_id String,
|
||||||
common_l4_protocol String,
|
common_l4_protocol String,
|
||||||
@@ -262,6 +264,7 @@ CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.session_record_cn ON CLUSTER ck
|
|||||||
common_server_ip String,
|
common_server_ip String,
|
||||||
common_client_port Int64,
|
common_client_port Int64,
|
||||||
common_server_port Int64,
|
common_server_port Int64,
|
||||||
|
common_server_fqdn String,
|
||||||
common_app_label String,
|
common_app_label String,
|
||||||
common_app_id String,
|
common_app_id String,
|
||||||
common_l4_protocol String,
|
common_l4_protocol String,
|
||||||
@@ -1825,7 +1828,7 @@ ENGINE = Distributed('ck_cluster',
|
|||||||
) AS
|
) AS
|
||||||
SELECT
|
SELECT
|
||||||
common_app_label AS app_name,
|
common_app_label AS app_name,
|
||||||
ssl_sni AS fqdn,
|
common_server_fqdn AS fqdn,
|
||||||
common_server_ip AS ip,
|
common_server_ip AS ip,
|
||||||
anyLast(server_country) AS country,
|
anyLast(server_country) AS country,
|
||||||
anyLast(server_province) AS province,
|
anyLast(server_province) AS province,
|
||||||
|
|||||||
Reference in New Issue
Block a user