Skip to content

Commit

Permalink
improve #892 and add #1355 changes for query audit service
Browse files Browse the repository at this point in the history
  • Loading branch information
vrindanayak committed Dec 10, 2018
1 parent ac76cdf commit ea2caa6
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,10 @@ private void auditConnectionFailure(AuditLogger auditLogger, Path path, AuditUti

void spoolQuery(QueryContext ctx) {
try {
boolean auditAggregate = getArchiveDevice().isAuditAggregate();
AuditLoggerDeviceExtension ext = device.getDeviceExtension(AuditLoggerDeviceExtension.class);
AuditUtils.EventType eventType = AuditUtils.EventType.QUERY__EVT;
AuditInfo auditInfo = ctx.getHttpRequest() != null ? createAuditInfoForQIDO(ctx) : createAuditInfoForFIND(ctx);
FileTime eventTime = null;
for (AuditLogger auditLogger : ext.getAuditLoggers()) {
if (!isSpoolingSuppressed(eventType, ctx.getCallingAET(), auditLogger)) {
Path directory = toDirPath(auditLogger);
Expand All @@ -436,7 +436,11 @@ void spoolQuery(QueryContext ctx) {
}
}
}
if (!auditAggregate)
if (eventTime == null)
eventTime = Files.getLastModifiedTime(file);
else
Files.setLastModifiedTime(file, eventTime);
if (!getArchiveDevice().isAuditAggregate())
auditAndProcessFile(auditLogger, file);
} catch (Exception e) {
LOG.warn("Failed to write to Query Audit Spool File {} : {}", auditLogger.getCommonName(), e);
Expand Down Expand Up @@ -472,8 +476,7 @@ private AuditInfo createAuditInfoForQIDO(QueryContext ctx) {

private boolean isSpoolingSuppressed(AuditUtils.EventType eventType, String userID, AuditLogger auditLogger) {
return !auditLogger.isInstalled()
|| (!auditLogger.getAuditSuppressCriteriaList().isEmpty()
&& auditLogger.isAuditMessageSuppressed(createMinimalAuditMsg(eventType, userID)));
|| auditLogger.isAuditMessageSuppressed(createMinimalAuditMsg(eventType, userID));
}

private AuditMessage createMinimalAuditMsg(AuditUtils.EventType eventType, String userID) {
Expand Down

0 comments on commit ea2caa6

Please sign in to comment.