Purpose
This function (expression) is used to set a filter on a user.
Applicability
This content 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');
Considerations
Parameters
user_name: specifies the user name.Note
The
user@hostspecified byAUDIT_LOG_FILTER_SET_USERdoes not need to be an existing user. You can specify a wildcard or a non-existent user. Theuser_nameparameter has the following limitations:- You cannot specify the
hostfield. - Only the wildcard
%is supported for theuserfield. The partial wildcardtest_%is not supported.
- You cannot specify the
filter_name: specifies the filter name.Note
AUDIT_LOG_FILTER_SET_USERhas theCREATE OR REPLACEsemantics. If an object already exists, the DDL operation will overwrite it. If the specifiedfilter_namedoes not exist, the DDL operation will not take effect, but no error will be returned.
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 output of the expression is the error message.
Examples
Set the log_all filter on 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