if (waf == null || waf.getWafType() == null) {
return null;
}
WafLogParserFactory factory = new WafLogParserFactory(wafRuleDao, securityEventDao);
WafLogParser parser = factory.getTracker(waf.getWafType().getName());
if (parser == null) {
return null;
}
parser.setWafId(String.valueOf(wafId));
if (fileAsString != null) {
parser.setFileAsString(fileAsString);
} else {
parser.setFile(fileAsMultipartFile);
}
log.info("About to parse " + waf.getWafType().getName() + " log file.");
List<SecurityEvent> events = parser.parseInput();
if (events.size() != 0) {
log.info("Found " + events.size() + " security events in the " + waf.getWafType().getName() + " log.");
} else {
log.warn("Found no security events in the " + waf.getWafType().getName() + " log.");