TSG-20680 对Source Country List中Country去重,为空的不记录
This commit is contained in:
@@ -15,6 +15,7 @@ import org.apache.flink.util.Collector;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zdjizhi.conf.DosConfigs.*;
|
||||
|
||||
@@ -162,22 +163,8 @@ public class DosDetectionFunction extends ProcessFunction<DosSketchLog, DosEvent
|
||||
}
|
||||
dosEventLog.setDestination_ip(value.getServer_ip());
|
||||
dosEventLog.setDestination_country(value.getServer_country());
|
||||
StringBuilder client_ips = new StringBuilder();
|
||||
StringBuilder client_countrys = new StringBuilder();
|
||||
Iterator<Map.Entry<String, String>> iterator = value.getClientips_countrys().entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, String> entry = iterator.next();
|
||||
client_ips.append(entry.getKey());
|
||||
client_countrys.append(entry.getValue());
|
||||
if (iterator.hasNext()) {
|
||||
client_ips.append(",");
|
||||
client_countrys.append(",");
|
||||
}
|
||||
}
|
||||
if(client_ips.length()>0){
|
||||
dosEventLog.setSource_ip_list(client_ips.toString());
|
||||
dosEventLog.setSource_country_list(client_countrys.toString());
|
||||
}
|
||||
dosEventLog.setSource_ip_list(value.getClient_ips().stream().filter(ip -> !ip.isEmpty()).collect(Collectors.joining(",")));
|
||||
dosEventLog.setSource_country_list(value.getClient_countrys().stream().filter(ip -> !ip.isEmpty()).collect(Collectors.joining(",")));
|
||||
dosEventLog.setSession_rate(value.getSession_rate());
|
||||
dosEventLog.setPacket_rate(value.getPacket_rate());
|
||||
dosEventLog.setBit_rate(value.getBit_rate());
|
||||
|
||||
Reference in New Issue
Block a user