eolivelli commented on a change in pull request #1105: ZOOKEEPER-1260:Audit 
logging in ZooKeeper servers.
URL: https://github.com/apache/zookeeper/pull/1105#discussion_r330779451
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/FinalRequestProcessor.java
 ##########
 @@ -514,4 +555,157 @@ public void shutdown() {
         LOG.info("shutdown of request processor complete");
     }
 
+    private void addSuccessAudit(Request request, ServerCnxn cnxn, String op, 
String path) {
+        addSuccessAudit(request, cnxn, op, path, null, null);
+    }
+
+    private void addSuccessAudit(Request request, ServerCnxn cnxn, String op, 
String path,
+        String acl, String createMode) {
+        if (!ZKAuditLogger.isAuditEnabled()) {
+            return;
+        }
+        ZKAuditLogger
+            .logSuccess(request.getUsers(), op, path, acl, createMode, 
cnxn.getSessionIdHex(),
+                cnxn.getHostAddress());
+    }
+
+    private void addFailureAudit(Request request, ServerCnxn cnxn, String op, 
String path) {
+        addFailureAudit(request, cnxn, op, path, null, null);
+    }
+
+    private void addFailureAudit(Request request, ServerCnxn cnxn, String op, 
String path,
+        String acl, String createMode) {
+        if (!ZKAuditLogger.isAuditEnabled()) {
+            return;
+        }
+        ZKAuditLogger
+            .logFailure(request.getUsers(), op, path, acl, createMode, 
cnxn.getSessionIdHex(),
+                cnxn.getHostAddress());
+    }
+
+    private void addAuditLog(Request request, ServerCnxn cnxn, String op, 
String path, String acl,
+        String createMode, Code err) {
+        if (!ZKAuditLogger.isAuditEnabled()) {
+            return;
+        }
+        if (err == Code.OK) {
+            ZKAuditLogger
+                .logSuccess(request.getUsers(), op, path, acl, createMode, 
cnxn.getSessionIdHex(),
+                    cnxn.getHostAddress());
+        } else {
+            ZKAuditLogger
+                .logFailure(request.getUsers(), op, path, acl, createMode, 
cnxn.getSessionIdHex(),
+                    cnxn.getHostAddress());
+        }
+    }
+
+    private String getACLs(Request request) {
+        ByteBuffer reqData = request.request.duplicate();
 
 Review comment:
   what about 'slice'?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to