This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
new c39acfdbf24 [fix](auditloader) support audit table millisecond and fix
stmt truncated by '\r' (#29481)
c39acfdbf24 is described below
commit c39acfdbf247df1eda6a535b582526b74aa6745b
Author: xueweizhang <[email protected]>
AuthorDate: Wed Jan 3 20:29:26 2024 +0800
[fix](auditloader) support audit table millisecond and fix stmt truncated
by '\r' (#29481)
Signed-off-by: nextdreamblue <[email protected]>
---
.../java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java
b/fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java
index ecbff0e6650..c7a6557c5f4 100755
---
a/fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java
+++
b/fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java
@@ -55,7 +55,7 @@ public class AuditLoaderPlugin extends Plugin implements
AuditPlugin {
private final static Logger LOG =
LogManager.getLogger(AuditLoaderPlugin.class);
private static final ThreadLocal<SimpleDateFormat> dateFormatContainer =
ThreadLocal.withInitial(
- () -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+ () -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"));
private StringBuilder auditLogBuffer = new StringBuilder();
private StringBuilder slowLogBuffer = new StringBuilder();
@@ -179,7 +179,9 @@ public class AuditLoaderPlugin extends Plugin implements
AuditPlugin {
logBuffer.append(event.peakMemoryBytes).append("\t");
// trim the query to avoid too long
// use `getBytes().length` to get real byte length
- String stmt = truncateByBytes(event.stmt).replace("\n", "
").replace("\t", " ");
+ String stmt = truncateByBytes(event.stmt).replace("\n", " ")
+ .replace("\t", " ")
+ .replace("\r", " ");
LOG.debug("receive audit event with stmt: {}", stmt);
logBuffer.append(stmt).append("\n");
}
@@ -338,7 +340,7 @@ public class AuditLoaderPlugin extends Plugin implements
AuditPlugin {
public static String longToTimeString(long timeStamp) {
if (timeStamp <= 0L) {
- return "1900-01-01 00:00:00";
+ return "1900-01-01 00:00:00.000";
}
return dateFormatContainer.get().format(new Date(timeStamp));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]