Purpose
This function (expression) is used to set a filter to a user.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support audit features.
Syntax
AUDIT_LOG_FILTER_SET_USER('user_name', 'filter_name');
Parameters
Parameters
user_name: specifies the user name.Note
AUDIT_LOG_FILTER_SET_USERallows you to specify a non-existent user or a wildcard in theuser@hostfield. Theuser_namefield has the following limitations:- You cannot specify the
hostfield. - You can only use the
%wildcard to match the entireuserfield, not partial wildcards such astest_%.
- You cannot specify the
filter_name: specifies the filter name.Note
AUDIT_LOG_FILTER_SET_USERhas theCREATE OR REPLACEsemantics. If the specifiedfilter_namedoes not exist, the DDL operation does not take effect but does not return an error.
Return value
The input must be a string constant, and the output is a string.
- If the DDL operation is successful, the expression returns
OK. - If the DDL operation fails, the
SELECTstatement still executes successfully, and the expression returns an error message.
Examples
Set the log_all filter to the user001 user.
SELECT AUDIT_LOG_FILTER_SET_USER('user001', 'log_all');
The return result is as follows:
+-------------------------------------------------+
| AUDIT_LOG_FILTER_SET_USER('user001', 'log_all') |
+-------------------------------------------------+
| OK |
+-------------------------------------------------+
1 row in set
