Purpose
This function (expression) is used to set filters on a user.
Syntax
AUDIT_LOG_FILTER_SET_USER('user_name', 'filter_name');
Description
Parameters
user_name: the username.Note
The
user@hostspecified inAUDIT_LOG_FILTER_SET_USERdoes not need to be an existing user. You can use a wildcard or a non-existent user. Theuser_namehas the following limitations:- The
hostfield cannot be specified. useronly supports wildcarding the entire field, that is,%. Partial wildcarding, such astest_%, is not supported.
- The
filter_name: the name of the filter.Note
AUDIT_LOG_FILTER_SET_USERhasCREATE OR REPLACEsemantics. Executing DDL on an existing object will overwrite it. If the specifiedfilter_namedoes not exist, the DDL will not take effect but no error will be reported either.
Return value
The expression input must be a string constant, and the output is of the string type.
- When the DDL statement is executed successfully, the expression returns
OK. - When DDL execution fails, the
SELECTstatement is still executed successfully, and the output of the expression is an error message.
Examples
Set the log_all filter for 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