You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/04/30 09:18:59 UTC

[GitHub] [incubator-doris] imay commented on a change in pull request #3444: [Bug][AuditPlugin] Fix bug that length of query stmt in audit should less than limit.

imay commented on a change in pull request #3444:
URL: https://github.com/apache/incubator-doris/pull/3444#discussion_r417872213



##########
File path: fe_plugins/auditloader/src/main/java/org/apache/doris/plugin/audit/AuditLoaderPlugin.java
##########
@@ -143,8 +143,9 @@ private void assembleAudit(AuditEvent event) {
         auditBuffer.append(event.isQuery ? 1 : 0).append("\t");
         auditBuffer.append(event.feIp).append("\t");
         // trim the query to avoid too long
-        int maxLen = Math.min(2048, event.stmt.length());
-        String stmt = event.stmt.substring(0, maxLen).replace("\t", " ");
+        // use `getBytes().length` to get real byte length
+        int maxLen = Math.min(2000, event.stmt.getBytes().length);

Review comment:
       Could you replace `2000` with a configuration or a `static final` variable?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org