use of org.apache.hadoop.ozone.audit.AuditMessage in project ozone by apache.
the class HddsDispatcher method audit.
private void audit(AuditAction action, EventType eventType, Map<String, String> params, AuditEventStatus result, Throwable exception) {
AuditMessage amsg;
switch(result) {
case SUCCESS:
if (isAllowed(action.getAction())) {
if (eventType == EventType.READ && AUDIT.getLogger().isInfoEnabled(AuditMarker.READ.getMarker())) {
amsg = buildAuditMessageForSuccess(action, params);
AUDIT.logReadSuccess(amsg);
} else if (eventType == EventType.WRITE && AUDIT.getLogger().isInfoEnabled(AuditMarker.WRITE.getMarker())) {
amsg = buildAuditMessageForSuccess(action, params);
AUDIT.logWriteSuccess(amsg);
}
}
break;
case FAILURE:
if (eventType == EventType.READ && AUDIT.getLogger().isErrorEnabled(AuditMarker.READ.getMarker())) {
amsg = buildAuditMessageForFailure(action, params, exception);
AUDIT.logReadFailure(amsg);
} else if (eventType == EventType.WRITE && AUDIT.getLogger().isErrorEnabled(AuditMarker.WRITE.getMarker())) {
amsg = buildAuditMessageForFailure(action, params, exception);
AUDIT.logWriteFailure(amsg);
}
break;
default:
if (LOG.isDebugEnabled()) {
LOG.debug("Invalid audit event status - {}", result);
}
}
}
Aggregations