Purpose
This function (expression) is used to set a filter on a user.
Applicability
This content is only applicable to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support the audit feature.
Syntax
AUDIT_LOG_FILTER_SET_USER('user_name', 'filter_name');
Considerations
Parameters
user_name: specifies the user name.Note
AUDIT_LOG_FILTER_SET_USERallows you to specify auser@hostthat does not exist, or a wildcard.user_namehas the following limitations:- You cannot specify the
hostfield. - Wildcard matching is supported only for the entire field, that is,
%. Partial wildcards such astest_%are not supported.
- You cannot specify the
filter_name: specifies the filter name.Note
AUDIT_LOG_FILTER_SET_USERhas theCREATE OR REPLACEsemantics. If the specified object already exists, the DDL operation will overwrite it. If the specifiedfilter_namedoes not exist, the DDL operation will not take effect and no error will be reported.
Return value
The input of the expression 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 to the user user001.
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