GAL-349 优化DoS检测程序知识库更新流程

This commit is contained in:
unknown
2023-06-08 16:57:19 +08:00
parent 6fb37324ff
commit b9a694ddb9
6 changed files with 256 additions and 144 deletions

View File

@@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit;
/**
* @author wlh
*/
public class DosDetection extends BroadcastProcessFunction<DosSketchLog,Map<String, byte[]>, DosEventLog> {
public class DosDetection extends BroadcastProcessFunction<DosSketchLog,Map<String, String>, DosEventLog> {
private static final Log logger = LogFactory.get();
private static Map<String, Map<String, DosBaselineThreshold>> baselineMap = new HashMap<>();
@@ -100,8 +100,10 @@ public class DosDetection extends BroadcastProcessFunction<DosSketchLog,Map<Stri
}
@Override
public void processBroadcastElement(Map<String, byte[]> value, Context ctx, Collector<DosEventLog> out) throws Exception {
IpUtils.updateIpLook(value);
public void processBroadcastElement(Map<String, String> value, Context ctx, Collector<DosEventLog> out) throws Exception {
if (!value.isEmpty()){
IpUtils.updateIpLook(value);
}
}
private DosEventLog getDosEventLogBySensitivityThreshold(DosSketchLog value) {
@@ -147,23 +149,6 @@ public class DosDetection extends BroadcastProcessFunction<DosSketchLog,Map<Stri
result = getDosEventLog(value, bitBase, diffByte, profileId, STATIC_CONDITION_TYPE, BITS_TAG);
}
// long base = threshold.getSessionsPerSec();
// long diff = value.getSketch_sessions() - base;
// long profileId = threshold.getProfileId();
// DosEventLog result = getDosEventLog(value, base, diff, profileId, STATIC_CONDITION_TYPE, SESSIONS_TAG);
// if (result == null) {
// base = threshold.getPacketsPerSec();
// diff = value.getSketch_packets() - base;
// profileId = threshold.getProfileId();
// result = getDosEventLog(value, base, diff,profileId, STATIC_CONDITION_TYPE, PACKETS_TAG);
// if (result == null) {
// base = threshold.getBitsPerSec();
// diff = value.getSketch_bytes() - base;
// profileId=threshold.getProfileId();
// result = getDosEventLog(value, base, diff, profileId, STATIC_CONDITION_TYPE, BITS_TAG);
// }
// }
/*
ArrayList<DosEventLog> dosEventLogs = new ArrayList<>();
if (result != null){