diff --git a/cyber_narrator/installation/clickhouse/cn_clickhouse_ddl.sql b/cyber_narrator/installation/clickhouse/cn_clickhouse_ddl.sql index 4d25834..056f6ac 100644 --- a/cyber_narrator/installation/clickhouse/cn_clickhouse_ddl.sql +++ b/cyber_narrator/installation/clickhouse/cn_clickhouse_ddl.sql @@ -884,6 +884,8 @@ CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.location_subscriber_local ON CL imsi String, phone_number String, apn String, + cell_id String, + cell_type Int64, subscriber_longitude Nullable(Float64), subscriber_latitude Nullable(Float64), first_location String, @@ -899,6 +901,8 @@ CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.location_subscriber ON CLUSTER imsi String, phone_number String, apn String, + cell_id String, + cell_type Int64, subscriber_longitude Nullable(Float64), subscriber_latitude Nullable(Float64), first_location String, @@ -1486,3 +1490,221 @@ GROUP BY ip, l7_protocol, port; + + +CREATE TABLE cyber_narrator_galaxy.match_indicator_local ON CLUSTER ck_cluster ( + indicator_fields String, + indicator_values String, + match_num Int64, + reset Int64, + client_ip String, + client_country_region String, + client_super_admin_area String, + client_admin_area String, + client_longitude Nullable(Float64), + client_latitude Nullable(Float64), + server_ip String, + server_country_region String, + server_super_admin_area String, + server_admin_area String, + server_longitude Nullable(Float64), + server_latitude Nullable(Float64), + domain String, + app String, + match_time Int64, + match_id UInt64, + rule_id UInt64, + rule_version String, + rule_type String, + is_builtin Int64, + event_type String, + event_name String, + severity Int64 +) +ENGINE = MergeTree +PARTITION BY toYYYYMMDD(toDate(match_time)) +ORDER BY (match_id, match_time); + +CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.match_indicator ON CLUSTER ck_cluster ( + indicator_fields String, + indicator_values String, + match_num Int64, + reset Int64, + client_ip String, + client_country_region String, + client_super_admin_area String, + client_admin_area String, + client_longitude Nullable(Float64), + client_latitude Nullable(Float64), + server_ip String, + server_country_region String, + server_super_admin_area String, + server_admin_area String, + server_longitude Nullable(Float64), + server_latitude Nullable(Float64), + domain String, + app String, + match_time Int64, + match_id UInt64, + rule_id UInt64, + rule_version String, + rule_type String, + is_builtin Int64, + event_type String, + event_name String, + severity Int64 +) ENGINE = Distributed('ck_cluster', 'cyber_narrator_galaxy', 'match_indicator_local', rand()); + + +CREATE TABLE cyber_narrator_galaxy.match_threshold_local ON CLUSTER ck_cluster ( + key_fields String, + key_values String, + threshold_value Float32, + metric_value Float32, + unit Int64 DEFAULT 1, + reset Int64, + start_time Int64, + end_time Int64, + match_id UInt64, + rule_id UInt64, + rule_version String, + rule_type String, + is_builtin Int64, + event_type String, + event_name String, + severity Int64 +) +ENGINE = MergeTree +PARTITION BY toYYYYMMDD(toDate(start_time)) +ORDER BY (match_id, start_time); + +CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.match_threshold ON CLUSTER ck_cluster ( + key_fields String, + key_values String, + threshold_value Float32, + metric_value Float32, + unit Int64 DEFAULT 1, + reset Int64, + start_time Int64, + end_time Int64, + match_id UInt64, + rule_id UInt64, + rule_version String, + rule_type String, + is_builtin Int64, + event_type String, + event_name String, + severity Int64 +) ENGINE = Distributed('ck_cluster', 'cyber_narrator_galaxy', 'match_threshold_local', rand()); + + +CREATE TABLE cyber_narrator_galaxy.match_sequence_local ON CLUSTER ck_cluster ( + key_fields String, + key_values String, + event_info String, + start_time Int64, + end_time Int64, + match_id UInt64, + rule_id UInt64, + rule_version String, + rule_type String, + is_builtin Int64, + event_type String, + event_name String, + severity Int64 +) +ENGINE = MergeTree +PARTITION BY toYYYYMMDD(toDate(start_time)) +ORDER BY (match_id, start_time); + +CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.match_sequence ON CLUSTER ck_cluster ( + key_fields String, + key_values String, + event_info String, + start_time Int64, + end_time Int64, + match_id UInt64, + rule_id UInt64, + rule_version String, + rule_type String, + is_builtin Int64, + event_type String, + event_name String, + severity Int64 +) ENGINE = Distributed('ck_cluster', 'cyber_narrator_galaxy', 'match_sequence_local', rand()); + + +CREATE TABLE cyber_narrator_galaxy.match_unordered_sequence_local ON CLUSTER ck_cluster ( + key_fields String, + key_values String, + event_info String, + start_time Int64, + end_time Int64, + match_id UInt64, + rule_id UInt64, + rule_version String, + rule_type String, + is_builtin Int64, + event_type String, + event_name String, + severity Int64 +) +ENGINE = MergeTree +PARTITION BY toYYYYMMDD(toDate(start_time)) +ORDER BY (match_id, start_time); + +CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.match_unordered_sequence ON CLUSTER ck_cluster ( + key_fields String, + key_values String, + event_info String, + start_time Int64, + end_time Int64, + match_id UInt64, + rule_id UInt64, + rule_version String, + rule_type String, + is_builtin Int64, + event_type String, + event_name String, + severity Int64 +) ENGINE = Distributed('ck_cluster', 'cyber_narrator_galaxy', 'match_unordered_sequence_local', rand()); +CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.cn_event_local ON CLUSTER ck_cluster( + event_id UInt64, + match_ids SimpleAggregateFunction(anyLast, String), + key_fields SimpleAggregateFunction(anyLast, String), + key_values SimpleAggregateFunction(anyLast, String), + rule_id SimpleAggregateFunction(anyLast, Int64), + rule_version SimpleAggregateFunction(anyLast, String), + rule_type SimpleAggregateFunction(anyLast, Int8), + is_builtin SimpleAggregateFunction(anyLast, Int8), + event_type SimpleAggregateFunction(anyLast, String), + event_name SimpleAggregateFunction(anyLast, String), + reset SimpleAggregateFunction(anyLast, Int64), + start_time SimpleAggregateFunction(min, Int64), + end_time SimpleAggregateFunction(max, Int64), + duration_s SimpleAggregateFunction(max, Int64), + status SimpleAggregateFunction(max, Int8) +) +ENGINE=AggregatingMergeTree ORDER BY event_id; + +CREATE TABLE IF NOT EXISTS cyber_narrator_galaxy.cn_event ON CLUSTER ck_cluster( + event_id UInt64, + match_ids SimpleAggregateFunction(anyLast, String), + key_fields SimpleAggregateFunction(anyLast, String), + key_values SimpleAggregateFunction(anyLast, String), + rule_id SimpleAggregateFunction(anyLast, Int64), + rule_version SimpleAggregateFunction(anyLast, String), + rule_type SimpleAggregateFunction(anyLast, Int8), + is_builtin SimpleAggregateFunction(anyLast, Int8), + event_type SimpleAggregateFunction(anyLast, String), + event_name SimpleAggregateFunction(anyLast, String), + reset SimpleAggregateFunction(anyLast, Int64), + start_time SimpleAggregateFunction(min, Int64), + end_time SimpleAggregateFunction(max, Int64), + duration_s SimpleAggregateFunction(max, Int64), + status SimpleAggregateFunction(max, Int8) +) +ENGINE = Distributed('ck_cluster', + 'cyber_narrator_galaxy', + 'cn_event_local', + rand()); \ No newline at end of file diff --git a/cyber_narrator/installation/clickhouse/cn_clickhouse_ddl_check.sql b/cyber_narrator/installation/clickhouse/cn_clickhouse_ddl_check.sql index cb72177..07797da 100644 --- a/cyber_narrator/installation/clickhouse/cn_clickhouse_ddl_check.sql +++ b/cyber_narrator/installation/clickhouse/cn_clickhouse_ddl_check.sql @@ -51,7 +51,18 @@ SELECT subscriber_id, app, imei, imsi, phone_number, apn, stat_time, sent_pkts, FROM cyber_narrator_galaxy.metric_subscriber_app where stat_time >= toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND match_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND match_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND stat_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND match_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND start_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time = toUnixTimestamp('2030-01-01 00:00:00') AND recv_time 'data',METADATA => {'DFS_REPLICATION' => '1'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '1'}} alter 'index_time_troubleshooting_file_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '1'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '1'}} alter 'index_filename_troubleshooting_file_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '1'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '1'}} alter 'index_partfile_troubleshooting_file_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '1'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '1'}} - alter 'assessment_file_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '1'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '1'}} alter 'index_time_assessment_file_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '1'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '1'}} alter 'index_filename_assessment_file_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '1'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '1'}} alter 'index_partfile_assessment_file_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '1'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '1'}} -alter 'knowledge_base_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '2'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '2'}} -alter 'index_time_knowledge_base_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '2'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '2'}} -alter 'index_filename_knowledge_base_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '2'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '2'}} -alter 'index_partfile_knowledge_base_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '2'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '2'}} - -alter 'report_snapshot_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '2'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '2'}} -alter 'index_time_report_snapshot_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '2'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '2'}} -alter 'index_filename_report_snapshot_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '2'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '2'}} -alter 'index_partfile_report_snapshot_bucket',{NAME => 'data',METADATA => {'DFS_REPLICATION' => '2'}},{NAME => 'meta', METADATA => {'DFS_REPLICATION' => '2'}} \ No newline at end of file +EOF diff --git a/tsg_olap/upgrade/TSG-24.09/hos/create_bucket_24.09.sh b/tsg_olap/upgrade/TSG-24.09/hos/create_bucket_24.09.sh index ad37488..0473632 100644 --- a/tsg_olap/upgrade/TSG-24.09/hos/create_bucket_24.09.sh +++ b/tsg_olap/upgrade/TSG-24.09/hos/create_bucket_24.09.sh @@ -4,5 +4,5 @@ curl -X PUT http://{{ vrrp_instance.oss.virtual_ipaddress }}:9098/hos/traffic_ht curl -X PUT http://{{ vrrp_instance.oss.virtual_ipaddress }}:9098/hos/traffic_eml_file_bucket -H 'token:{{ hos_token }}' -H 'x-hos-region-count:16' -H 'x-hos-ttl:30' -H 'x-hos-replication:1' curl -X PUT http://{{ vrrp_instance.oss.virtual_ipaddress }}:9098/hos/troubleshooting_file_bucket -H 'token:{{ hos_token }}' -H 'x-hos-region-count:16' -H 'x-hos-ttl:30' -H 'x-hos-replication:1' curl -X PUT http://{{ vrrp_instance.oss.virtual_ipaddress }}:9098/hos/assessment_file_bucket -H 'token:{{ hos_token }}' -H 'x-hos-region-count:16' -H 'x-hos-wal:open' -H 'x-hos-ttl:30' -H 'x-hos-replication:1' -curl -X PUT http://{{ vrrp_instance.oss.virtual_ipaddress }}:9098/hos/knowledge_base_bucket -H 'token:{{ hos_token }}' -H 'x-hos-region-count:16' -H 'x-hos-wal:open' -H 'x-hos-replication:2' -curl -X PUT http://{{ vrrp_instance.oss.virtual_ipaddress }}:9098/hos/report_snapshot_bucket -H 'token:{{ hos_token }}' -H 'x-hos-region-count:16' -H 'x-hos-wal:open' -H 'x-hos-replication:2' \ No newline at end of file +curl -X PUT http://{{ vrrp_instance.oss.virtual_ipaddress }}:9098/hos/knowledge_base_bucket -H 'token:{{ hos_token }}' -H 'x-hos-region-count:16' -H 'x-hos-wal:open' -H 'x-hos-replication:单机为1集群为2' +curl -X PUT http://{{ vrrp_instance.oss.virtual_ipaddress }}:9098/hos/report_snapshot_bucket -H 'token:{{ hos_token }}' -H 'x-hos-region-count:16' -H 'x-hos-wal:open' -H 'x-hos-replication:单机为1集群为2' \ No newline at end of file diff --git a/tsg_olap/upgrade/TSG-24.09/hos/hosutil/config.properties b/tsg_olap/upgrade/TSG-24.09/hos/hosutil/config.properties new file mode 100644 index 0000000..5cb5164 --- /dev/null +++ b/tsg_olap/upgrade/TSG-24.09/hos/hosutil/config.properties @@ -0,0 +1,21 @@ +qgw.server.addr=http://192.168.44.67:9999 +hos.server.addr=http://192.168.44.67:9098 +hos.token=c21f969b5f03d33d43e04f8f136e7682 +kafka.server=192.168.44.11:9092 +#延迟时间,校验多少秒之前的文件,单位秒 +check.time.delay=180 +hos.traffic.buckets=traffic_policy_capture_file_bucket,traffic_rtp_file_bucket,traffic_http_file_bucket,traffic_eml_file_bucket +kafka.traffic.topics=TRAFFIC-POLICY-CAPTURE-FILE-STREAM-RECORD,TRAFFIC-RTP-FILE-STREAM-RECORD,TRAFFIC-HTTP-FILE-STREAM-RECORD,TRAFFIC-EML-FILE-STREAM-RECORD +kafka.troubleshooting.topic=TROUBLESHOOTING-FILE-STREAM-RECORD +file.chunk.combiner.window.time=15000 +traffic.file.count=10 +threads=1 +max.threads=10 +print.out.interval=1000 +http.max.total=100 +http.default.max.per.route=100 +http.connect.timeout=5000 +http.connection.request.timeout=10000 +http.socket.timeout=-1 +hos.log.types=security_event,monitor_event,proxy_event,session_record,voip_record,assessment_event,transaction_record,troubleshooting +hos.log.types.file.types.url.fields=security_event:http-http_response_body&http_request_body,pcap-packet_capture_file&rtp_pcap_path,eml-mail_eml_file;proxy_event:http-http_response_body&http_request_body;session_record:http-http_response_body&http_request_body,pcap-packet_capture_file&rtp_pcap_path,eml-mail_eml_file;voip_record:pcap-rtp_pcap_path;assessment_event:other-assessment_file;transaction_record:http-http_response_body&http_request_body,eml-mail_eml_file;monitor_event:http-http_response_body&http_request_body,pcap-packet_capture_file&rtp_pcap_path,eml-mail_eml_file \ No newline at end of file diff --git a/tsg_olap/upgrade/TSG-24.09/hos/hosutil/galaxy-hos-util-1.4.jar b/tsg_olap/upgrade/TSG-24.09/hos/hosutil/galaxy-hos-util-1.4.jar new file mode 100644 index 0000000..9b05a71 Binary files /dev/null and b/tsg_olap/upgrade/TSG-24.09/hos/hosutil/galaxy-hos-util-1.4.jar differ diff --git a/tsg_olap/upgrade/TSG-24.09/hos/hosutil/hosutil.sh b/tsg_olap/upgrade/TSG-24.09/hos/hosutil/hosutil.sh new file mode 100644 index 0000000..e74c7ff --- /dev/null +++ b/tsg_olap/upgrade/TSG-24.09/hos/hosutil/hosutil.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +version="1.4" +jar="galaxy-hos-util-$version.jar" + +usage() { + cat <&2; usage; exit 1 ;; + :) echo "Option -$OPTARG requires an argument" >&2; usage; exit 1 ;; + esac +done + +case "$operation" in + download) download ;; + upload) upload ;; + check) check ;; + combiner) combiner ;; + version) echo $version ;; + *) usage; exit 1 ;; +esac +