コード例 #1
0
 /** A helper api for creating an audit log for a successful event. */
 static String createSuccessLog(
     String user,
     String operation,
     String target,
     ApplicationId appId,
     ApplicationAttemptId attemptId,
     ContainerId containerId,
     CallerContext callerContext) {
   StringBuilder b = new StringBuilder();
   start(Keys.USER, user, b);
   addRemoteIP(b);
   add(Keys.OPERATION, operation, b);
   add(Keys.TARGET, target, b);
   add(Keys.RESULT, AuditConstants.SUCCESS, b);
   if (appId != null) {
     add(Keys.APPID, appId.toString(), b);
   }
   if (attemptId != null) {
     add(Keys.APPATTEMPTID, attemptId.toString(), b);
   }
   if (containerId != null) {
     add(Keys.CONTAINERID, containerId.toString(), b);
   }
   appendCallerContext(b, callerContext);
   return b.toString();
 }
コード例 #2
0
 static String createFailureLog(
     String user,
     String operation,
     String perm,
     String target,
     String description,
     ApplicationId appId,
     ApplicationAttemptId attemptId,
     ContainerId containerId,
     CallerContext callerContext) {
   StringBuilder b = new StringBuilder();
   start(Keys.USER, user, b);
   addRemoteIP(b);
   add(Keys.OPERATION, operation, b);
   add(Keys.TARGET, target, b);
   add(Keys.RESULT, AuditConstants.FAILURE, b);
   add(Keys.DESCRIPTION, description, b);
   add(Keys.PERMISSIONS, perm, b);
   if (appId != null) {
     add(Keys.APPID, appId.toString(), b);
   }
   if (attemptId != null) {
     add(Keys.APPATTEMPTID, attemptId.toString(), b);
   }
   if (containerId != null) {
     add(Keys.CONTAINERID, containerId.toString(), b);
   }
   appendCallerContext(b, callerContext);
   return b.toString();
 }