1、PXY IP替换 PXY_INTERCEPT_PKT_BIN表类型改为14(字符串类域);

2、添加Ntc BGP原始日志查询接口
This commit is contained in:
zhangdongxu
2018-08-22 14:42:59 +08:00
parent 3b5e7ecb9f
commit c275c8a07e
5 changed files with 108 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
package com.nis.domain.restful;
import com.nis.domain.LogEntity;
/**
*
* @ClassName:NtcBgpLog
* @Description:TODO(这里用一句话描述这个类的作用)
* @author (zdx)
* @date 2018年8月22日 下午2:18:06
* @version V1.0
*/
public class NtcBgpLog extends LogEntity<NtcBgpLog> {
private static final long serialVersionUID = -990806269407561021L;
}

View File

@@ -1,6 +1,5 @@
package com.nis.web.controller.restful; package com.nis.web.controller.restful;
import java.sql.ResultSet;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -19,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.nis.domain.LogEntity; import com.nis.domain.LogEntity;
import com.nis.domain.Page; import com.nis.domain.Page;
import com.nis.domain.restful.NtcAppLog; import com.nis.domain.restful.NtcAppLog;
import com.nis.domain.restful.NtcBgpLog;
import com.nis.domain.restful.NtcDdosLog; import com.nis.domain.restful.NtcDdosLog;
import com.nis.domain.restful.NtcDnsLog; import com.nis.domain.restful.NtcDnsLog;
import com.nis.domain.restful.NtcFtpLog; import com.nis.domain.restful.NtcFtpLog;
@@ -36,7 +36,6 @@ import com.nis.restful.RestServiceException;
import com.nis.util.Configurations; import com.nis.util.Configurations;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.DateUtils; import com.nis.util.DateUtils;
import com.nis.util.HiveJDBC;
import com.nis.util.HiveJDBCByDruid; import com.nis.util.HiveJDBCByDruid;
import com.nis.util.JsonMapper; import com.nis.util.JsonMapper;
import com.nis.web.controller.BaseRestController; import com.nis.web.controller.BaseRestController;
@@ -909,6 +908,67 @@ public class NtcLogSearchController extends BaseRestController {
ntcP2pLogPage, 0); ntcP2pLogPage, 0);
} }
@RequestMapping(value = "/ntcBgpLogs", method = RequestMethod.GET)
@ApiOperation(value = "BGP日志查询", httpMethod = "GET", notes = "对应配置为“其他-BGP”存储动作为阻断和监测的命中日志。对日志功能“BGP日志”提供数据基础查询服务")
public Map<String, ?> ntcBgpLogs(Page page, NtcBgpLog ntcBgpLog, Model model, HttpServletRequest request,
HttpServletResponse response) {
long start = System.currentTimeMillis();
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET,
request, null);
Page<NtcBgpLog> ntcBgpLogPage = null;
try {
resetTime(ntcBgpLog);
ntcLogService.queryConditionCheck(auditLogThread, start, ntcBgpLog, NtcBgpLog.class, page);
ntcBgpLogPage = new Page<NtcBgpLog>();
ntcBgpLogPage.setPageNo(page.getPageNo());
ntcBgpLogPage.setPageSize(page.getPageSize());
String orderBy = "";
if (null != page.getOrderBy() && !page.getOrderBy().equals("")) {
orderBy = Page.getOrderBySql(NtcBgpLog.class.getSimpleName(), page.getOrderBy());
} else {
orderBy = "found_Time";
}
String sql = HiveSqlService.getSql(page, ntcBgpLog,
Configurations.getStringProperty(NtcBgpLog.class.getSimpleName() + "HiveTable", "ntc_bgp_log"),
getCol2Col(), orderBy, null);
Map<String, List<Object>> tableMapping = new HiveJDBCByDruid().tableMapping(page, null, sql, NtcBgpLog.class, "foundTime",
"recvTime");
if (tableMapping == null) {
ntcBgpLogPage.setList(new ArrayList());
} else {
List list = tableMapping.get("obj");
// if (tableMapping.get("obj").size() > page.getPageSize()) {
// list = tableMapping.get("obj").subList(0, page.getPageSize());
// } else {
// list = tableMapping.get("obj").subList(0, tableMapping.get("obj").size());
// }
if (list.size() > 0) {
String jsonString = JsonMapper.toJsonString(list);
List<NtcBgpLog> List = (java.util.List<NtcBgpLog>) JsonMapper.fromJsonList(jsonString,
NtcBgpLog.class);
ntcBgpLogPage.setList(List);
ntcBgpLogPage.setCount(List.size());
} else {
ntcBgpLogPage.setList(new ArrayList());
}
}
} catch (Exception e) {
e.printStackTrace();
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
logger.error(e);
if (!(e instanceof RestServiceException)) {
e = new RestServiceException(auditLogThread, System.currentTimeMillis() - start, "BGP日志检索失败");
}
throw ((RestServiceException) e);
}
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "BGP日志检索成功",
ntcBgpLogPage, 0);
}
/** /**
*判断开始和结束时间是否为null,如果为null则初始化时间 *判断开始和结束时间是否为null,如果为null则初始化时间
* @param entity * @param entity

View File

@@ -982,4 +982,30 @@
<result column="d_subscribe_id" jdbcType="VARCHAR" property="dSubscribeId" /> <result column="d_subscribe_id" jdbcType="VARCHAR" property="dSubscribeId" />
<result column="scene_file" jdbcType="VARCHAR" property="sceneFile" /> <result column="scene_file" jdbcType="VARCHAR" property="sceneFile" />
</resultMap> </resultMap>
<resultMap id="NtcBgpLogMap" type="com.nis.domain.restful.NtcBgpLog">
<result column="cfg_id" jdbcType="BIGINT" property="cfgId" />
<result column="found_Time" jdbcType="TIMESTAMP" property="foundTime" />
<result column="recv_Time" jdbcType="TIMESTAMP" property="recvTime" />
<result column="trans_proto" jdbcType="VARCHAR" property="transProto" />
<result column="addr_type" jdbcType="INTEGER" property="addrType" />
<result column="d_ip" jdbcType="VARCHAR" property="dIp" />
<result column="s_ip" jdbcType="VARCHAR" property="sIp" />
<result column="d_port" jdbcType="VARCHAR" property="dPort" />
<result column="s_port" jdbcType="VARCHAR" property="sPort" />
<result column="service" jdbcType="INTEGER" property="service" />
<result column="entrance_id" jdbcType="BIGINT" property="entranceId" />
<result column="device_id" jdbcType="INTEGER" property="deviceId" />
<result column="direction" jdbcType="INTEGER" property="direction" />
<result column="stream_dir" jdbcType="INTEGER" property="streamDir" />
<result column="cap_ip" jdbcType="VARCHAR" property="capIp" />
<result column="addr_list" jdbcType="VARCHAR" property="addrList" />
<result column="user_region" jdbcType="VARCHAR" property="userRegion" />
<result column="server_locate" jdbcType="VARCHAR" property="serverLocate" />
<result column="client_locate" jdbcType="VARCHAR" property="clientLocate" />
<result column="s_asn" jdbcType="VARCHAR" property="sAsn" />
<result column="d_asn" jdbcType="VARCHAR" property="dAsn" />
<result column="s_subscribe_id" jdbcType="VARCHAR" property="sSubscribeId" />
<result column="d_subscribe_id" jdbcType="VARCHAR" property="dSubscribeId" />
<result column="scene_file" jdbcType="VARCHAR" property="sceneFile" />
</resultMap>
</mapper> </mapper>

View File

@@ -144,7 +144,7 @@ service=1:128;2:128;16:16;17:16;18:16;19:16;20:16;21:16;22:16;23:16;24:16;26:16;
#0x203 PXY限速域名 #0x203 PXY限速域名
515=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;14:PXY_INTERCEPT_DOMAIN,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE 515=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;14:PXY_INTERCEPT_DOMAIN,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x205 基于PXY IP替换 #0x205 基于PXY IP替换
517=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;13:PXY_INTERCEPT_PKT_BIN;14:PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE 517=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_INTERCEPT_PKT_BIN,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE
#0x209 PXY拦截白名单 #0x209 PXY拦截白名单
521=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_INTERCEPT_DOMAIN,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE 521=10:PXY_INTERCEPT_COMPILE;11:PXY_INTERCEPT_GROUP;12:PXY_INTERCEPT_IP;14:PXY_INTERCEPT_DOMAIN,PXY_CRTL_SUBSCRIBE_ID;18:NTC_IP_RANGE

View File

@@ -13,6 +13,7 @@ NtcFtpLogHiveTable=NTC_FTP_LOG
NtcAppLogHiveTable=NTC_APP_LOG NtcAppLogHiveTable=NTC_APP_LOG
NtcDdosLogHiveTable=NTC_DDOS_LOG NtcDdosLogHiveTable=NTC_DDOS_LOG
NtcP2pLogHiveTable=NTC_P2P_LOG NtcP2pLogHiveTable=NTC_P2P_LOG
NtcBgpLogHiveTable=NTC_BGP_LOG
DkBehaviorLogHiveTable=DK_BEHAVIOR_LOG DkBehaviorLogHiveTable=DK_BEHAVIOR_LOG
MmAvIpLogHiveTable=MM_AV_IP_LOG MmAvIpLogHiveTable=MM_AV_IP_LOG
MmAvUrlLogHiveTable=MM_AV_URL_LOG MmAvUrlLogHiveTable=MM_AV_URL_LOG