Revert "[Improvement](auditlog) add column catalog for audit log and audit log table (#26403)" (#28177)

This reverts commit daea751a98.
This commit is contained in:
zhiqiang authored and GitHub committed 2023-12-08 18:46:59 +08:00
1 parent 75b55f8f2f
commit 0931eb536c
7 files changed
+2 -20

No files matched your search

-2
View File
@@ -87,7 +87,6 @@ create table doris_audit_db__.doris_audit_log_tbl__
`time` datetime not null comment "Query start time",
client_ip varchar(32) comment "Client IP",
user varchar(64) comment "User name",
catalog varchar(128) comment "Catalog of this query",
db varchar(96) comment "Database of this query",
state varchar(8) comment "Query result state. EOF, ERR, OK",
error_code int comment "Error code of failing query.",
@@ -124,7 +123,6 @@ create table doris_audit_db__.doris_slow_log_tbl__
`time` datetime not null comment "Query start time",
client_ip varchar(32) comment "Client IP",
user varchar(64) comment "User name",
catalog varchar(128) comment "Catalog of this query",
db varchar(96) comment "Database of this query",
state varchar(8) comment "Query result state. EOF, ERR, OK",
error_code int comment "Error code of failing query.",
@@ -93,7 +93,6 @@ create table doris_audit_db__.doris_audit_log_tbl__
`time` datetime not null comment "Query start time",
client_ip varchar(32) comment "Client IP",
user varchar(64) comment "User name",
catalog varchar(128) comment "Catalog of this query",
db varchar(96) comment "Database of this query",
state varchar(8) comment "Query result state. EOF, ERR, OK",
error_code int comment "Error code of failing query.",
@@ -130,7 +129,6 @@ create table doris_audit_db__.doris_slow_log_tbl__
`time` datetime not null comment "Query start time",
client_ip varchar(32) comment "Client IP",
user varchar(64) comment "User name",
catalog varchar(128) comment "Catalog of this query",
db varchar(96) comment "Database of this query",
state varchar(8) comment "Query result state. EOF, ERR, OK",
error_code int comment "Error code of failing query.",
@@ -56,8 +56,6 @@ public class AuditEvent {
public String clientIp = "";
@AuditField(value = "User")
public String user = "";
@AuditField(value = "Catalog")
public String catalog = "";
@AuditField(value = "Db")
public String db = "";
@AuditField(value = "State")
@@ -133,11 +131,6 @@ public class AuditEvent {
return this;
}
public AuditEventBuilder setCatalog(String catalog) {
auditEvent.catalog = catalog;
return this;
}
public AuditEventBuilder setDb(String db) {
auditEvent.db = db;
return this;
@@ -57,11 +57,6 @@ public class AuditLogHelper {
.setWorkloadGroup(ctx.getWorkloadGroupName())
.setFuzzyVariables(!printFuzzyVariables ? "" : ctx.getSessionVariable().printFuzzyVariables());
// when doric fe is booting, current catalog may not be set
if (ctx.getCurrentCatalog() != null) {
ctx.getAuditEventBuilder().setCatalog(ctx.getCurrentCatalog().getName());
}
if (ctx.getState().isQuery()) {
MetricRepo.COUNTER_QUERY_ALL.increase(1L);
MetricRepo.USER_COUNTER_QUERY_ALL.getOrAdd(ctx.getQualifiedUser()).increase(1L);
@@ -163,7 +163,6 @@ public class AuditLoaderPlugin extends Plugin implements AuditPlugin {
logBuffer.append(longToTimeString(event.timestamp)).append("\t");
logBuffer.append(event.clientIp).append("\t");
logBuffer.append(event.user).append("\t");
logBuffer.append(event.catalog).append("\t");
logBuffer.append(event.db).append("\t");
logBuffer.append(event.state).append("\t");
logBuffer.append(event.errorCode).append("\t");
@@ -71,7 +71,7 @@ public class DorisStreamLoader {
conn.addRequestProperty("label", label);
conn.addRequestProperty("max_filter_ratio", "1.0");
conn.addRequestProperty("columns", "query_id, `time`, client_ip, user, catalog, db, state, error_code, error_message, " +
conn.addRequestProperty("columns", "query_id, `time`, client_ip, user, db, state, error_code, error_message, " +
"query_time, scan_bytes, scan_rows, return_rows, stmt_id, is_query, frontend_ip, cpu_time_ms, sql_hash, " +
"sql_digest, peak_memory_bytes, stmt");
@@ -88,7 +88,7 @@ public class DorisStreamLoader {
sb.append("-H \"").append("Expect\":").append("\"100-continue\" \\\n ");
sb.append("-H \"").append("Content-Type\":").append("\"text/plain; charset=UTF-8\" \\\n ");
sb.append("-H \"").append("max_filter_ratio\":").append("\"1.0\" \\\n ");
sb.append("-H \"").append("columns\":").append("\"query_id, time, client_ip, user, catalog, db, state, error_code, " +
sb.append("-H \"").append("columns\":").append("\"query_id, time, client_ip, user, db, state, error_code, " +
"error_message, query_time, scan_bytes, scan_rows, return_rows, stmt_id, is_query, frontend_ip, " +
"cpu_time_ms, sql_hash, sql_digest, peak_memory_bytes, stmt\" \\\n ");
sb.append("\"").append(conn.getURL()).append("\"");
-1
View File
@@ -181,7 +181,6 @@ def add_auditload_plugin():
\`time\` datetime not null comment 'Query start time', \
client_ip varchar(32) comment 'Client IP', \
user varchar(64) comment 'User name', \
catalog varchar(128) comment 'Catalog of this query', \
db varchar(96) comment 'Database of this query', \
state varchar(8) comment 'Query result state. EOF, ERR, OK', \
query_time bigint comment 'Query execution time in millisecond', \