diff --git a/src/main/java/com/zdjizhi/etl/DosDetection.java b/src/main/java/com/zdjizhi/etl/DosDetection.java index 5a138a4..5d5ce85 100644 --- a/src/main/java/com/zdjizhi/etl/DosDetection.java +++ b/src/main/java/com/zdjizhi/etl/DosDetection.java @@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit; */ public class DosDetection extends BroadcastProcessFunction, DosEventLog> { - // private static final Logger logger = LoggerFactory.getLogger(DosDetection.class); private static final Log logger = LogFactory.get(); private static Map> baselineMap = new HashMap<>(); private final static NumberFormat PERCENT_INSTANCE = NumberFormat.getPercentInstance(); @@ -66,7 +65,7 @@ public class DosDetection extends BroadcastProcessFunction out) { - ArrayList finalResults = new ArrayList<>(); + DosEventLog finalResult = null; try { String destinationIp = value.getDestination_ip(); int vsysId = value.getVsys_id(); @@ -81,26 +80,21 @@ public class DosDetection extends BroadcastProcessFunction getDosEventLogByStaticThreshold(DosSketchLog value, DosDetectionThreshold threshold) throws CloneNotSupportedException { + private DosEventLog getDosEventLogByStaticThreshold(DosSketchLog value, DosDetectionThreshold threshold) throws CloneNotSupportedException { long base = threshold.getSessionsPerSec(); long diff = value.getSketch_sessions() - base; DosEventLog result = getDosEventLog(value, base, diff, STATIC_CONDITION_TYPE, SESSIONS_TAG); @@ -139,6 +133,7 @@ public class DosDetection extends BroadcastProcessFunction dosEventLogs = new ArrayList<>(); if (result != null){ dosEventLogs.add(result); @@ -152,7 +147,8 @@ public class DosDetection extends BroadcastProcessFunction> reportIpList = jsonMapperInstance.fromJson(jsonMapperInstance.toJson(sketchSource.get("report_ip_list")), listType); for (HashMap obj : reportIpList) { DosSketchLog dosSketchLog = new DosSketchLog();