You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by arshadmohammad <gi...@git.apache.org> on 2018/09/12 20:34:38 UTC

[GitHub] zookeeper pull request #338: ZOOKEEPER-1260:Audit logging in ZooKeeper serve...

Github user arshadmohammad commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/338#discussion_r217179236
  
    --- Diff: src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java ---
    @@ -250,30 +267,36 @@ public void processRequest(Request request) {
                     lastOp = "CREA";
                     rsp = new Create2Response(rc.path, rc.stat);
                     err = Code.get(rc.err);
    +                addAuditLog(request, cnxn, AuditConstants.OP_CREATE, rc.path, null, err);
                     break;
                 }
                 case OpCode.delete:
                 case OpCode.deleteContainer: {
                     lastOp = "DELE";
                     err = Code.get(rc.err);
    +                addAuditLog(request, cnxn, AuditConstants.OP_DELETE, rc.path, null, err);
                     break;
                 }
                 case OpCode.setData: {
                     lastOp = "SETD";
                     rsp = new SetDataResponse(rc.stat);
                     err = Code.get(rc.err);
    +                addAuditLog(request, cnxn, AuditConstants.OP_SETDATA, rc.path, null, err);
                     break;
                 }
                 case OpCode.reconfig: {
                     lastOp = "RECO";
                     rsp = new GetDataResponse(((QuorumZooKeeperServer)zks).self.getQuorumVerifier().toString().getBytes(), rc.stat);
                     err = Code.get(rc.err);
    +                addAuditLog(request, cnxn, AuditConstants.OP_RECONFIG, rc.path, null, err);
                     break;
                 }
                 case OpCode.setACL: {
                     lastOp = "SETA";
                     rsp = new SetACLResponse(rc.stat);
                     err = Code.get(rc.err);
    +                addAuditLog(request, cnxn, AuditConstants.OP_SETACL, rc.path, getACLs(request),
    --- End diff --
    
    corrected, added one more check at the before making audit log itself
    if (ZKAuditLogger.isAuditEnabled()) {
                        addAuditLog(request, cnxn, AuditConstants.OP_SETACL, rc.path, getACLs(request), err);
                    }


---