24
24
import org .apache .doris .plugin .PluginInfo .PluginType ;
25
25
import org .apache .doris .plugin .PluginMgr ;
26
26
27
+ import com .google .common .base .Strings ;
27
28
import com .google .common .collect .Queues ;
29
+ import com .google .common .collect .Sets ;
28
30
import org .apache .logging .log4j .LogManager ;
29
31
import org .apache .logging .log4j .Logger ;
30
32
31
33
import java .util .List ;
34
+ import java .util .Set ;
32
35
import java .util .concurrent .BlockingQueue ;
33
36
import java .util .concurrent .TimeUnit ;
34
37
@@ -50,16 +53,30 @@ public class AuditEventProcessor {
50
53
51
54
private volatile boolean isStopped = false ;
52
55
56
+ private Set <String > skipAuditUsers = Sets .newHashSet ();
57
+
53
58
public AuditEventProcessor (PluginMgr pluginMgr ) {
54
59
this .pluginMgr = pluginMgr ;
55
60
}
56
61
57
62
public void start () {
63
+ initSkipAuditUsers ();
58
64
workerThread = new Thread (new Worker (), "AuditEventProcessor" );
59
65
workerThread .setDaemon (true );
60
66
workerThread .start ();
61
67
}
62
68
69
+ private void initSkipAuditUsers () {
70
+ if (Strings .isNullOrEmpty (Config .skip_audit_user_list )) {
71
+ return ;
72
+ }
73
+ String [] users = Config .skip_audit_user_list .replaceAll (" " , "" ).split ("," );
74
+ for (String user : users ) {
75
+ skipAuditUsers .add (user );
76
+ }
77
+ LOG .info ("skip audit users: {}" , skipAuditUsers );
78
+ }
79
+
63
80
public void stop () {
64
81
isStopped = true ;
65
82
if (workerThread != null ) {
@@ -72,6 +89,10 @@ public void stop() {
72
89
}
73
90
74
91
public boolean handleAuditEvent (AuditEvent auditEvent ) {
92
+ if (skipAuditUsers .contains (auditEvent .user )) {
93
+ // return true to ignore this event
94
+ return true ;
95
+ }
75
96
boolean isAddSucc = true ;
76
97
try {
77
98
if (eventQueue .size () >= Config .audit_event_log_queue_size ) {
0 commit comments