Java Code Examples for org.apache.ranger.audit.model.AuthzAuditEvent#setSeqNum()

The following examples show how to use org.apache.ranger.audit.model.AuthzAuditEvent#setSeqNum() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RangerDefaultAuditHandler.java    From ranger with Apache License 2.0 6 votes vote down vote up
private void populateDefaults(AuthzAuditEvent auditEvent) {
	if( auditEvent.getAclEnforcer() == null || auditEvent.getAclEnforcer().isEmpty()) {
		auditEvent.setAclEnforcer("ranger-acl"); // TODO: review
	}

	if (auditEvent.getAgentHostname() == null || auditEvent.getAgentHostname().isEmpty()) {
		auditEvent.setAgentHostname(MiscUtil.getHostname());
	}

	if (auditEvent.getLogType() == null || auditEvent.getLogType().isEmpty()) {
		auditEvent.setLogType("RangerAudit");
	}

	if (auditEvent.getEventId() == null || auditEvent.getEventId().isEmpty()) {
		auditEvent.setEventId(generateNextAuditEventId());
	}

	if (auditEvent.getAgentId() == null) {
		auditEvent.setAgentId(MiscUtil.getApplicationType());
	}

	auditEvent.setSeqNum(sequenceNumber++);
}
 
Example 2
Source File: TestAuditQueue.java    From ranger with Apache License 2.0 5 votes vote down vote up
private AuthzAuditEvent createEvent(String user, String accessType,
		String resource, boolean isAllowed) {
	AuthzAuditEvent event = new AuthzAuditEvent();
	event.setUser(user);
	event.setAccessType(accessType);
	event.setResourcePath(resource);
	event.setAccessResult(isAllowed ? (short) 1 : (short) 0);

	event.setSeqNum(++seqNum);
	return event;
}
 
Example 3
Source File: ElasticSearchAccessAuditsServiceTest.java    From ranger with Apache License 2.0 5 votes vote down vote up
private AuthzAuditEvent getAuthzAuditEvent() {
    AuthzAuditEvent event = new AuthzAuditEvent();
    event.setAccessResult((short) 1);
    event.setAccessType("");
    event.setAclEnforcer("");
    event.setAction("");
    event.setAdditionalInfo("");
    event.setAgentHostname("");
    event.setAgentId("");
    event.setClientIP("");
    event.setClusterName("");
    event.setClientType("");
    event.setEventCount(1);
    event.setEventDurationMS(1);
    event.setEventId("");
    event.setEventTime(new Date());
    event.setLogType("");
    event.setPolicyId(1);
    event.setPolicyVersion(1l);
    event.setRepositoryName("");
    event.setRequestData("");
    event.setRepositoryName("");
    event.setRepositoryType(1);
    event.setResourcePath("");
    event.setResultReason("");
    event.setSeqNum(1);
    event.setSessionId("");
    event.setTags(new HashSet<>());
    event.setUser("");
    event.setZoneName("");
    return event;
}
 
Example 4
Source File: TestAuditQueue.java    From ranger with Apache License 2.0 4 votes vote down vote up
private AuthzAuditEvent createEvent() {
	AuthzAuditEvent event = new AuthzAuditEvent();
	event.setSeqNum(++seqNum);
	return event;
}