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 08:43:01 UTC

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

morningman opened a new pull request #3444:
URL: https://github.com/apache/incubator-doris/pull/3444


   Use `String.getBytes().length` instead of `String.length()` to get the real byte length of a string.
   Fix: #3443 
   
   Also fix the typo of `max_filter_ratio` in audit log plugin.


----------------------------------------------------------------
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


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

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #3444:
URL: https://github.com/apache/incubator-doris/pull/3444#discussion_r418080730



##########
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:
       done




----------------------------------------------------------------
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


[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.

Posted by GitBox <gi...@apache.org>.
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