style:remove redundant logic
This commit is contained in:
@@ -75,7 +75,6 @@ public class TypeMapCompleted extends ProcessFunction<String, JSONObject> {
|
||||
jsonObject.put("common_action", actionMap.get(record.get("proxy_action").toString().replace(" ","")));
|
||||
}
|
||||
|
||||
|
||||
jsonObject.put("common_ingestion_time", ctx.timestamp() / 1000);
|
||||
TransForm.transformLog(jsonObject);
|
||||
MetaUtil.typeTransform(jsonObject);
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.zdjizhi.common.FlowWriteConfig;
|
||||
import com.zdjizhi.common.pojo.FileMeta;
|
||||
import com.zdjizhi.common.pojo.SourceList;
|
||||
import com.zdjizhi.tools.general.FileEdit;
|
||||
import org.apache.flink.api.java.tuple.Tuple5;
|
||||
import org.apache.flink.api.java.tuple.Tuple7;
|
||||
import org.apache.flink.configuration.Configuration;
|
||||
import org.apache.flink.streaming.api.functions.ProcessFunction;
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.alibaba.fastjson2.*;
|
||||
import com.geedgenetworks.utils.IpLookupV2;
|
||||
import com.geedgenetworks.utils.StringUtil;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.zdjizhi.common.CommonConfig;
|
||||
import com.zdjizhi.common.FlowWriteConfig;
|
||||
import com.zdjizhi.common.pojo.KnowlegeBaseMeta;
|
||||
import com.zdjizhi.tools.connections.http.HttpClientService;
|
||||
@@ -204,9 +203,4 @@ public class IpLookupUtils {
|
||||
}
|
||||
return knowlegeBaseMeta;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
final String countryLookup = IpLookupUtils.getIpLookup().asnLookup("10.64.10.7");
|
||||
System.out.println(countryLookup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zdjizhi.tools.logtransformation;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
|
||||
import java.util.*;
|
||||
@@ -32,22 +31,6 @@ public class ConvertRecordToPERCENT {
|
||||
percent.put("common_start_time", (long) record.get("start_timestamp_ms") / 1000);
|
||||
percent.put("common_end_time", (long) record.get("end_timestamp_ms") / 1000);
|
||||
|
||||
|
||||
if (record.containsKey("security_rule_list")) {
|
||||
percent.put("common_policy_id", (Integer) JSONArray.from(record.get("security_rule_list")).get(0));
|
||||
percent.put("common_action", fillingCommonAction((String) record.get("security_action")));
|
||||
}
|
||||
|
||||
if (record.containsKey("monitor_rule_list")) {
|
||||
percent.put("common_policy_id", (Integer) JSONArray.from(record.get("monitor_rule_list")).get(0));
|
||||
percent.put("common_action", 1);
|
||||
}
|
||||
|
||||
if (record.containsKey("proxy_rule_list")) {
|
||||
percent.put("common_policy_id", (Integer) JSONArray.from(record.get("proxy_rule_list")).get(0));
|
||||
percent.put("common_action", fillingCommonAction((String) record.get("proxy_action")));
|
||||
}
|
||||
|
||||
//填充common_sessions
|
||||
percent.put("common_sessions", 1);
|
||||
|
||||
@@ -77,58 +60,6 @@ public class ConvertRecordToPERCENT {
|
||||
return percent;
|
||||
}
|
||||
|
||||
private int fillingCommonAction(String action) {
|
||||
int number;
|
||||
switch (action) {
|
||||
case "none":
|
||||
number = 0;
|
||||
break;
|
||||
case "Monitor":
|
||||
case "monitor":
|
||||
number = 1;
|
||||
break;
|
||||
case "Intercept":
|
||||
case "intercept":
|
||||
number = 2;
|
||||
break;
|
||||
case "No Intercept":
|
||||
number = 3;
|
||||
break;
|
||||
case "Active Defence":
|
||||
number = 4;
|
||||
break;
|
||||
case "WAN NAT":
|
||||
number = 8;
|
||||
break;
|
||||
case "Reject":
|
||||
case "Deny":
|
||||
number = 16;
|
||||
break;
|
||||
case "Shaping":
|
||||
number = 32;
|
||||
break;
|
||||
case "Manipulate":
|
||||
number = 48;
|
||||
break;
|
||||
case "Service Chaining":
|
||||
number = 64;
|
||||
break;
|
||||
case "Allow":
|
||||
case "Bypass":
|
||||
number = 96;
|
||||
break;
|
||||
case "Shunt":
|
||||
number = 128;
|
||||
break;
|
||||
case "Statistics":
|
||||
number = 129;
|
||||
break;
|
||||
default:
|
||||
number = 0;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
public JSONObject removeFields(JSONObject record) {
|
||||
for (Map.Entry<String, String> entry : recordSchema.entrySet()) {
|
||||
if (record.containsKey(entry.getValue())) {
|
||||
|
||||
Reference in New Issue
Block a user