Purpose
AUDIT_LOG_FILTER_SET_USER() configures a filter for a user.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support security audit.
Syntax
AUDIT_LOG_FILTER_SET_USER('user_name', 'filter_name');
Description
Parameters
user_name: the username.Note
The value of
user@hostspecified in theAUDIT_LOG_FILTER_SET_USERfunction is not necessarily the name of an existing user. It can be a wildcard character or the name of a user that does not exist. Take note of the following limitations when you specifyuser_name:- The
hostfield cannot be specified. - You can use a wildcard character, such as
%, to replace the entireuserfield. You cannot use a wildcard character to replace only a part of theuserfield, for example,test_%.
- The
filter_name: the name of the filter.Note
The
AUDIT_LOG_FILTER_SET_USERfunction adopts theCREATE OR REPLACEsemantics. It overwrites an existing object when you perform a DDL operation on the object. If the filter specified byfilter_namedoes not exist, the DDL operation neither takes effect nor returns an error.
Return value
The input of the function 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 is still successfully executed, and the expression outputs an error message.
Examples
Configure the log_all filter for 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