Logo
事中审计

审计 #

语法描述类型
SHOW AUDIT STRATEGIES查看审计策略RQL
CREATE AUDIT STRATEGY audit_rule (MATCHING_ALGORITHMS(TYPE(NAME=” “)),ACTION_ALGORITHMS(TYPE(NAME=” “)))创建审计策略RDL
ALTER AUDIT STRATEGY audit_rule (MATCHING_ALGORITHMS(TYPE(NAME=” “)),ACTION_ALGORITHMS(TYPE(NAME=” “)))修改审计策略RDL
DROP AUDIT STRATEGY audit_rule1,audit_rule2删除审计策略RDL

1. 查看审计策略 #

SHOW AUDIT STRATEGIES

示例

查看所有审计策略

SHOW AUDIT STRATEGIES
+---------------+----------------+---------------------+-----------------+
| strategy_name | algorithm_type | algorithm_type_name | algorithm_props |
+---------------+----------------+---------------------+-----------------+
| risk_dml      | matching       | risk_dml            |                 |
| risk_dml      | action         | block               |                 |
| risk_ddl      | matching       | risk_ddl            |                 |
| risk_ddl      | action         | block               |                 |
+---------------+----------------+---------------------+-----------------+

查看指定审计策略

SHOW AUDIT STRATEGY join_query;
+---------------+----------------+---------------------+--------------------------------+
| strategy_name | algorithm_type | algorithm_type_name | algorithm_props                |
+---------------+----------------+---------------------+--------------------------------+
| join_query    | matching       | join_query          | max-allowed-join-table-count=3 |
| join_query    | action         | block               |                                |
+---------------+----------------+---------------------+--------------------------------+

输出说明

说明
strategy_name策略名称
algorithm_type算法类型
algorithm_type_name算法名称
algorithm_props算法参数

2. 创建审计策略 #

CREATE AUDIT STRATEGY audit_rule (MATCHING_ALGORITHMS(TYPE(NAME=" ")),ACTION_ALGORITHMS(TYPE(NAME=" "))) 

示例

创建单场景审计策略

CREATE AUDIT STRATEGY join_query (
MATCHING_ALGORITHMS(
    TYPE(NAME="JOIN_QUERY",PROPERTIES("max-allowed-join-table-count"=2))
),
ACTION_ALGORITHMS(
    TYPE(NAME="BLOCK")
));

创建组合场景审计策略

CREATE AUDIT STRATEGY sharding_whitelist (
MATCHING_ALGORITHMS(
    TYPE(NAME="SHARDING"),
    TYPE(NAME="USERNAME",PROPERTIES("whitelist"="root"))
),
ACTION_ALGORITHMS(
    TYPE(NAME="BLOCK")
));

参数说明

相关算法请参考内置算法

3. 修改审计策略 #

ALTER AUDIT STRATEGY audit_rule (MATCHING_ALGORITHMS(TYPE(NAME=" ")),ACTION_ALGORITHMS(TYPE(NAME=" "))) 

示例

修改审计策略

ALTER AUDIT STRATEGY join_query (
MATCHING_ALGORITHMS(
    TYPE(NAME="JOIN_QUERY",PROPERTIES("max-allowed-join-table-count"=2))
),
ACTION_ALGORITHMS(
    TYPE(NAME="BLOCK")
));

参数说明

相关算法请参考内置算法

4. 删除审计策略 #

DROP AUDIT STRATEGY  audit_rule1,audit_rule2

示例

删除单个审计策略

DROP AUDIT STRATEGY join_query;

删除多个审计策略

DROP AUDIT STRATEGY join_query1,join_query2;

参数说明

相关算法请参考内置算法