This is an automated email from the ASF dual-hosted git repository.
wenweihuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 73c9350011 [INLONG-9914][Audit] Add SQL related to audit-service
(#9915)
73c9350011 is described below
commit 73c935001152610fcda2ce8af18e9d75298e2cbd
Author: doleyzi <[email protected]>
AuthorDate: Tue Apr 2 13:01:47 2024 +0800
[INLONG-9914][Audit] Add SQL related to audit-service (#9915)
* Add SQL related to audit-service
* Add SQL related to audit-service
---
.../apcache_inlong_audit_aggregate.sql} | 39 +++++++++++++++-------
.../sql/{ => audit-store}/apache_inlong_audit.sql | 0
.../apache_inlong_audit_clickhouse.sql | 0
.../{ => audit-store}/clickhouse-changes-1.9.0.sql | 0
.../sql/{ => audit-store}/mysql-changes-1.9.0.sql | 0
5 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/inlong-audit/sql/apache_inlong_audit.sql
b/inlong-audit/sql/audit-service/apcache_inlong_audit_aggregate.sql
similarity index 51%
copy from inlong-audit/sql/apache_inlong_audit.sql
copy to inlong-audit/sql/audit-service/apcache_inlong_audit_aggregate.sql
index a2b007534a..5794355533 100644
--- a/inlong-audit/sql/apache_inlong_audit.sql
+++ b/inlong-audit/sql/audit-service/apcache_inlong_audit_aggregate.sql
@@ -28,26 +28,41 @@ CREATE DATABASE IF NOT EXISTS apache_inlong_audit;
USE apache_inlong_audit;
-- ----------------------------
--- Table structure for audit_data
+-- Table structure for audit_data_temp
+-- You can create daily partitions or hourly partitions through the log_ts
field.
+-- The specific partition type is determined based on the actual data volume.
-- ----------------------------
-CREATE TABLE IF NOT EXISTS `audit_data`
+CREATE TABLE IF NOT EXISTS `audit_data_temp`
(
- `id` int(32) NOT NULL PRIMARY KEY AUTO_INCREMENT
COMMENT 'Incremental primary key',
- `ip` varchar(32) NOT NULL DEFAULT '' COMMENT 'Client IP',
- `docker_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'Client docker
id',
- `thread_id` varchar(50) NOT NULL DEFAULT '' COMMENT 'Client thread
id',
- `sdk_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT
'SDK timestamp',
- `packet_id` BIGINT NOT NULL DEFAULT '0' COMMENT 'Packet id',
- `log_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT
'Log timestamp',
+ `log_ts` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT
'log timestamp',
`inlong_group_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'The target
inlong group id',
`inlong_stream_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'The target
inlong stream id',
`audit_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'Audit id',
`audit_tag` varchar(100) DEFAULT '' COMMENT 'Audit tag',
- `audit_version` BIGINT DEFAULT -1 COMMENT 'Audit version',
`count` BIGINT NOT NULL DEFAULT '0' COMMENT 'Message
count',
`size` BIGINT NOT NULL DEFAULT '0' COMMENT 'Message
size',
`delay` BIGINT NOT NULL DEFAULT '0' COMMENT 'Message
delay count',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP COMMENT 'Update time',
- INDEX group_stream_audit_id (`inlong_group_id`, `inlong_stream_id`,
`audit_id`, `log_ts`)
+ PRIMARY KEY
(`log_ts`,`inlong_group_id`,`inlong_stream_id`,`audit_id`,`audit_tag`)
) ENGINE = InnoDB
- DEFAULT CHARSET = utf8 COMMENT ='Inlong audit data table';
+DEFAULT CHARSET = utf8 COMMENT ='Inlong audit data temp table';
+
+-- ----------------------------
+-- Table structure for audit_data_day
+-- You can create daily partitions through the log_ts field.
+-- The specific partition type is determined based on the actual data volume.
+-- ----------------------------
+CREATE TABLE IF NOT EXISTS `audit_data_day`
+(
+ `log_ts` date NOT NULL DEFAULT '0000-00-00' COMMENT 'log
timestamp',
+ `inlong_group_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'The target
inlong group id',
+ `inlong_stream_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'The target
inlong stream id',
+ `audit_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'Audit id',
+ `audit_tag` varchar(100) DEFAULT '' COMMENT 'Audit tag',
+ `count` BIGINT NOT NULL DEFAULT '0' COMMENT 'Message
count',
+ `size` BIGINT NOT NULL DEFAULT '0' COMMENT 'Message
size',
+ `delay` BIGINT NOT NULL DEFAULT '0' COMMENT 'Message
delay count',
+ `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP COMMENT 'Update time',
+ PRIMARY KEY
(`log_ts`,`inlong_group_id`,`inlong_stream_id`,`audit_id`,`audit_tag`)
+) ENGINE = InnoDB
+DEFAULT CHARSET = utf8 COMMENT ='Inlong audit data day table';
diff --git a/inlong-audit/sql/apache_inlong_audit.sql
b/inlong-audit/sql/audit-store/apache_inlong_audit.sql
similarity index 100%
rename from inlong-audit/sql/apache_inlong_audit.sql
rename to inlong-audit/sql/audit-store/apache_inlong_audit.sql
diff --git a/inlong-audit/sql/apache_inlong_audit_clickhouse.sql
b/inlong-audit/sql/audit-store/apache_inlong_audit_clickhouse.sql
similarity index 100%
rename from inlong-audit/sql/apache_inlong_audit_clickhouse.sql
rename to inlong-audit/sql/audit-store/apache_inlong_audit_clickhouse.sql
diff --git a/inlong-audit/sql/clickhouse-changes-1.9.0.sql
b/inlong-audit/sql/audit-store/clickhouse-changes-1.9.0.sql
similarity index 100%
rename from inlong-audit/sql/clickhouse-changes-1.9.0.sql
rename to inlong-audit/sql/audit-store/clickhouse-changes-1.9.0.sql
diff --git a/inlong-audit/sql/mysql-changes-1.9.0.sql
b/inlong-audit/sql/audit-store/mysql-changes-1.9.0.sql
similarity index 100%
rename from inlong-audit/sql/mysql-changes-1.9.0.sql
rename to inlong-audit/sql/audit-store/mysql-changes-1.9.0.sql