1# test filtering by sql_command
2
3# test set/unset filters
4
5SET GLOBAL audit_log_include_commands= 'create_table,create_procedure,create_trigger,insert';
6SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
7--error ER_WRONG_VALUE_FOR_VAR
8SET GLOBAL audit_log_exclude_commands= 'alter_db_upgrade,change_db,drop_table,drop_db';
9--error ER_WRONG_VALUE_FOR_VAR
10SET GLOBAL audit_log_exclude_commands= NULL;
11SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
12SET GLOBAL audit_log_include_commands= 'alter_db_upgrade,change_db,drop_table,drop_db';
13SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
14SET GLOBAL audit_log_include_commands= '';
15SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
16--error ER_WRONG_VALUE_FOR_VAR
17SET GLOBAL audit_log_exclude_commands= 'insert,call_procedure,call_procedure,set_option,assign_to_keycache';
18SET GLOBAL audit_log_include_commands= NULL;
19SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
20
21SET GLOBAL audit_log_exclude_commands= "insert,call_procedure,call_procedure,set_option,assign_to_keycache";
22SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
23--error ER_WRONG_VALUE_FOR_VAR
24SET GLOBAL audit_log_include_commands= 'change_db,drop_table@localhost';
25--error ER_WRONG_VALUE_FOR_VAR
26SET GLOBAL audit_log_include_commands= NULL;
27SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
28SET GLOBAL audit_log_exclude_commands= 'change_db,drop_table';
29SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
30SET GLOBAL audit_log_exclude_commands= '';
31SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
32--error ER_WRONG_VALUE_FOR_VAR
33SET GLOBAL audit_log_include_commands= 'change_db';
34SET GLOBAL audit_log_exclude_commands= NULL;
35SELECT @@audit_log_include_commands, @@audit_log_exclude_commands;
36
37# test filtering
38
39let $MYSQLD_DATADIR= `select @@datadir`;
40let $log_file=$MYSQLD_DATADIR/test_audit.log;
41
42SET GLOBAL audit_log_flush=ON;
43--remove_file $log_file
44SET GLOBAL audit_log_flush=ON;
45
46# log everything
47SET GLOBAL audit_log_exclude_commands= NULL;
48SET GLOBAL audit_log_include_commands= NULL;
49
50--source audit_log_filter_commands_events.inc
51
52# log everything once again
53SET GLOBAL audit_log_include_commands= 'set_option,creaTE_DB,CHANGE_DB,CREATE_TABLE,CREATE_TABLE,CREATE_PROCEDURE,CREATE_TRIGger,insert,insert,insert,call_procedure,call_procedure,set_option,assign_to_keycache,alter_db,alter_db_upgrade,change_db,drop_table,drop_db';
54
55--source audit_log_filter_commands_events.inc
56
57# log some of the commands
58SET GLOBAL audit_log_include_commands= 'set_option,creaTE_DB,CHANGE_DB,assign_to_keycache,alter_db,alter_db_upgrade';
59
60--source audit_log_filter_commands_events.inc
61
62# log nothing
63SET GLOBAL audit_log_include_commands= NULL;
64SET GLOBAL audit_log_exclude_commands= 'set_option,create_db,change_db,create_table,create_table,create_prOCEDURE,CREATE_TRIGGER,INSERT,INSERT,INSERT,CALL_PROCEDURE,CALL_PROCEDUre,set_option,assign_to_keycache,alter_db,alter_db_upgrade,change_db,drop_table,drop_db';
65
66--source audit_log_filter_commands_events.inc
67
68SET GLOBAL audit_log_exclude_commands= NULL;
69SET GLOBAL audit_log_include_commands= NULL;
70
71--source audit_log_echo.inc
72