.getResource("/sink-audit.log.gz");
ModSecurity2AuditReader reader = new ModSecurity2AuditReader(
new GZIPInputStream(url.openStream()));
AuditEvent e = reader.readNext();
while (e != null) {
log.info("------------------------------------");
log.info("AuditEvent {}", e.get(ModSecurity.TX_ID));
String p1 = e.get(ModSecurity.PERF_PHASE1);
String p2 = e.get(ModSecurity.PERF_PHASE2);
String p3 = e.get(ModSecurity.PERF_PHASE3);
String p4 = e.get(ModSecurity.PERF_PHASE4);
String p5 = e.get(ModSecurity.PERF_PHASE5);
log.info("Phase1: {}ms", p1);
log.info("Phase2: {}ms", p2);
log.info("Phase3: {}ms", p3);
log.info("Phase4: {}ms", p4);
log.info("Phase5: {}ms", p5);
for (String var : AuditEventParser.PERF_VARIABLES) {
try {
log.info("Value of '{}' is {}", var, new Long(e.get(var)));
Assert.assertTrue("performance variable '" + var
+ "' missing!", p1 != null && !p1.trim().isEmpty());
} catch (NumberFormatException nfe) {
log.error("Failed to parse variable {} with value {}", var,
e.get(var));
}
}
log.info("------------------------------------");
e = reader.readNext();