From: jsimomaa Date: Sat, 16 Mar 2019 14:44:10 +0000 (+0200) Subject: Fetch all audit logging events X-Git-Tag: v1.43.0~136^2~177^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F79%2F2779%2F1;p=simantics%2Fplatform.git Fetch all audit logging events gitlab #274 Change-Id: I50f7368d758a3bbac424506db65966062895a213 --- diff --git a/bundles/org.simantics.auditlogging/scl/Simantics/AuditLogging/Server.scl b/bundles/org.simantics.auditlogging/scl/Simantics/AuditLogging/Server.scl index 9304294c0..b7278e9e2 100644 --- a/bundles/org.simantics.auditlogging/scl/Simantics/AuditLogging/Server.scl +++ b/bundles/org.simantics.auditlogging/scl/Simantics/AuditLogging/Server.scl @@ -7,6 +7,7 @@ importJava "org.simantics.audit.AuditLogging" where trace :: String -> Map.T String a -> () getLogEventsDays :: String -> String -> Integer -> [String] getLogEvents :: String -> String -> String -> String -> [String] + allLogEvents :: String -> Integer -> Map.T String [String] importJava "org.simantics.audit.server.AuditLoggingServer" where start :: String -> Integer -> () \ No newline at end of file diff --git a/bundles/org.simantics.auditlogging/src/org/simantics/audit/AuditLogging.java b/bundles/org.simantics.auditlogging/src/org/simantics/audit/AuditLogging.java index 334e19c47..3cd6ac392 100644 --- a/bundles/org.simantics.auditlogging/src/org/simantics/audit/AuditLogging.java +++ b/bundles/org.simantics.auditlogging/src/org/simantics/audit/AuditLogging.java @@ -41,6 +41,24 @@ public class AuditLogging { } } + public static Map> allLogEvents(String level, int days) throws AuditLoggingException { + Map> results = new HashMap<>(); + try { + Files.walk(Activator.getLogLocation()).forEach(uuid -> { + String fileName = uuid.getFileName().toString(); + try { + List events = getLogEventsDays(fileName, level, days); + results.put(fileName, events); + } catch (AuditLoggingException e) { + LOGGER.error("Could not get audit log events for {}", fileName, e); + } + }); + } catch (IOException e) { + throw new AuditLoggingException(e); + } + return results; + } + /** * Gets audit events for the last 5 days *