Skip to content

Commit

Permalink
[INLONG-9914][Audit] Add SQL related to audit-service (#9915)
Browse files Browse the repository at this point in the history
* Add SQL related to audit-service

* Add SQL related to audit-service
  • Loading branch information
doleyzi authored Apr 2, 2024
1 parent 8903184 commit 73c9350
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions inlong-audit/sql/audit-service/apcache_inlong_audit_aggregate.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

-- ----------------------------
-- Database for InLong Audit
-- ----------------------------
CREATE DATABASE IF NOT EXISTS apache_inlong_audit;

USE apache_inlong_audit;

-- ----------------------------
-- 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_temp`
(
`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',
`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 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';
File renamed without changes.
File renamed without changes.

0 comments on commit 73c9350

Please sign in to comment.