This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 2d0dc8a49a1 [fix](auditloader) support audit table millisecond and fix stmt truncated by '\r' (#29479) (#29486) 2d0dc8a49a1 is described below commit 2d0dc8a49a1c362ec77efdc0798b1cf1c1834c67 Author: xueweizhang <zxw520bl...@163.com> AuthorDate: Sun Jan 7 11:02:09 2024 +0800 [fix](auditloader) support audit table millisecond and fix stmt truncated by '\r' (#29479) (#29486) --- .../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 3cfb0eeeaee..4c5586ed881 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 @@ -57,7 +57,7 @@ import java.util.stream.Collectors; public class AuditLoaderPlugin extends Plugin implements AuditPlugin { private final static Logger LOG = LogManager.getLogger(AuditLoaderPlugin.class); - private static final DateTimeFormatter DATETIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss") + private static final DateTimeFormatter DATETIME_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS") .withZone(ZoneId.systemDefault()); private StringBuilder auditLogBuffer = new StringBuilder(); @@ -180,7 +180,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"); } @@ -355,7 +357,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 DATETIME_FORMAT.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(timeStamp), ZoneId.systemDefault())); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org