From f3a7a3f1e1cd4b109ca192c93a95af9843d80cf3 Mon Sep 17 00:00:00 2001 From: renkaige Date: Thu, 25 Oct 2018 11:47:14 +0800 Subject: [PATCH] =?UTF-8?q?1:=E6=96=B0=E5=A2=9E=E5=A6=82=E4=B8=8B=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=200x28=20=E7=BD=91=E9=A1=B5=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E5=AD=97=E9=98=BB=E6=96=AD=200x98=20=E7=BD=91=E9=A1=B5?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E5=AD=97=E7=9B=91=E6=B5=8B=200x42=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E8=B4=A6=E5=8F=B7=E7=99=BD=E5=90=8D=E5=8D=95=202:?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0NTC=5FKEYWORDS=5FURL=5FLOG=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nis/domain/restful/NtcKeywordsUrlLog.java | 30 ++++++++++ .../restful/NtcLogSearchController.java | 60 ++++++++++++++++++- .../java/com/nis/web/dao/DfLogSearchDao.xml | 30 ++++++++++ .../applicationConfig-rule.properties | 18 ++++-- .../applicationLog-clickhouse.properties | 1 + .../resources/applicationLog-hive.properties | 1 + .../maatXml/applicationConfig-maatRedis.xml | 2 +- 7 files changed, 134 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/nis/domain/restful/NtcKeywordsUrlLog.java diff --git a/src/main/java/com/nis/domain/restful/NtcKeywordsUrlLog.java b/src/main/java/com/nis/domain/restful/NtcKeywordsUrlLog.java new file mode 100644 index 0000000..6631d65 --- /dev/null +++ b/src/main/java/com/nis/domain/restful/NtcKeywordsUrlLog.java @@ -0,0 +1,30 @@ +package com.nis.domain.restful; + +import com.nis.domain.LogEntity; + +public class NtcKeywordsUrlLog extends LogEntity { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String url; + private String website; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getWebsite() { + return website; + } + + public void setWebsite(String website) { + this.website = website; + } + +} diff --git a/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java b/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java index 1ad03ee..ba8a027 100644 --- a/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java +++ b/src/main/java/com/nis/web/controller/restful/NtcLogSearchController.java @@ -8,7 +8,6 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.zdjizhi.utils.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @@ -25,6 +24,7 @@ import com.nis.domain.restful.NtcFtpLog; import com.nis.domain.restful.NtcHttpLog; import com.nis.domain.restful.NtcIpLog; import com.nis.domain.restful.NtcIpsecLog; +import com.nis.domain.restful.NtcKeywordsUrlLog; import com.nis.domain.restful.NtcL2tpLog; import com.nis.domain.restful.NtcMailLog; import com.nis.domain.restful.NtcOpenvpnLog; @@ -35,11 +35,10 @@ import com.nis.domain.restful.NtcSslLog; import com.nis.domain.restful.NtcStreamingMediaLog; import com.nis.domain.restful.NtcVoipLog; import com.nis.restful.RestServiceException; -import com.nis.util.Configurations; import com.nis.util.Constants; import com.nis.util.DateUtils; -import com.nis.util.LogJDBCByDruid; import com.nis.util.JsonMapper; +import com.nis.util.LogJDBCByDruid; import com.nis.web.controller.BaseRestController; import com.nis.web.service.AuditLogThread; import com.nis.web.service.HiveSqlService; @@ -47,6 +46,7 @@ import com.nis.web.service.ServicesRequestLogService; import com.nis.web.service.restful.NtcLogService; import com.wordnik.swagger.annotations.Api; import com.wordnik.swagger.annotations.ApiOperation; +import com.zdjizhi.utils.StringUtil; /** * @ClassName:NtcLogSearchController @@ -1079,6 +1079,60 @@ public class NtcLogSearchController extends BaseRestController { logPage, 0); } + @RequestMapping(value = "/ntcKeywordsUrlLogs", method = RequestMethod.GET) + @ApiOperation(value = "NTC关键字转URL日志查询", httpMethod = "GET", notes = "对日志功能“NTC关键字转URL日志”提供数据基础查询服务") + public Map ntcKeywordsUrlLogs(Page page, NtcKeywordsUrlLog ntcKeywordsUrlLog, Model model, HttpServletRequest request, + HttpServletResponse response) { + long start = System.currentTimeMillis(); + AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, + request, null); + + Page logPage = null; + try { + resetTime(ntcKeywordsUrlLog); + ntcLogService.queryConditionCheck(auditLogThread, start, ntcKeywordsUrlLog, NtcKeywordsUrlLog.class, page); + logPage = new Page(); + logPage.setPageNo(page.getPageNo()); + logPage.setPageSize(page.getPageSize()); + String orderBy = ""; + if (null != page.getOrderBy() && !page.getOrderBy().equals("")) { + orderBy = Page.getOrderBySql(NtcStreamingMediaLog.class.getSimpleName(), page.getOrderBy()); + } else { + orderBy = "found_Time"; + } + String sql = HiveSqlService.getSql(page, ntcKeywordsUrlLog, + getTableName(NtcKeywordsUrlLog.class.getSimpleName() + "HiveTable", "NTC_KEYWORDS_URL_LOG"), + getCol2Col(), orderBy, null); + Map> tableMapping = new LogJDBCByDruid().tableMapping(page, null, sql, NtcStreamingMediaLog.class, "foundTime", + "recvTime"); + if (tableMapping == null) { + logPage.setList(new ArrayList()); + } else { + List list = tableMapping.get("obj"); + if (list.size() > 0) { + String jsonString = JsonMapper.toJsonString(list); + List List = (java.util.List) JsonMapper.fromJsonList(jsonString, + NtcStreamingMediaLog.class); + logPage.setList(List); + logPage.setCount(List.size()); + + } else { + logPage.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, "NTC关键字转URL日志检索失败"); + } + throw ((RestServiceException) e); + } + return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "NTC关键字转URL日志检索成功", + logPage, 0); + } + /** *判断开始和结束时间是否为null,如果为null则初始化时间 * @param entity diff --git a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml index 5d1a72d..06947fb 100644 --- a/src/main/java/com/nis/web/dao/DfLogSearchDao.xml +++ b/src/main/java/com/nis/web/dao/DfLogSearchDao.xml @@ -1229,4 +1229,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/applicationConfig-rule.properties b/src/main/resources/applicationConfig-rule.properties index b2f90d4..61ac8e7 100644 --- a/src/main/resources/applicationConfig-rule.properties +++ b/src/main/resources/applicationConfig-rule.properties @@ -20,7 +20,7 @@ ##回流 0x60 96 loop ##白名单 0x80 128 whitelist -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;27:16;30:16;31:16;32:16;33:16;34:16;35:16;36:16;37:16;38:16;39:16;128:1;129:1;130:1;131:1;132:1;133:1;134:1;135:1;136:1;137:1;138:1;139:1;140:1;142:1;143:1;144:1;145:1;146:1;147:1;148:1;149:1;150:1;151:1;256:128;257:128;258:16;259:16;260:16;267:16;271:16;272:16;273:16;384:1;385:1;386:1;387:1;388:1;395:1;399:1;512:1;513:1;514:64;515:64;517:80;521:128;528:48;544:2;560:80;576:16;592:1;750:128;768:96;1024:1;1025:1;1026:1;1027:1;1028:1;1029:1;1030:1;1040:32;1041:32;1042:32;1056:64;1057:64;1058:64;1059:64;1060:64;1152:1 +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;27:16;30:16;31:16;32:16;33:16;34:16;35:16;36:16;37:16;38:16;39:16;40:16;66:128;128:1;129:1;130:1;131:1;132:1;133:1;134:1;135:1;136:1;137:1;138:1;139:1;140:1;142:1;143:1;144:1;145:1;146:1;147:1;148:1;149:1;150:1;151:1;152:1;256:128;257:128;258:16;259:16;260:16;267:16;271:16;272:16;273:16;384:1;385:1;386:1;387:1;388:1;395:1;399:1;512:1;513:1;514:64;515:64;517:80;521:128;528:48;544:2;560:80;576:16;592:1;750:128;768:96;1024:1;1025:1;1026:1;1027:1;1028:1;1029:1;1030:1;1040:32;1041:32;1042:32;1056:64;1057:64;1058:64;1059:64;1060:64;1152:1 #0x1E 0x8E 有问题:14:NTC_XMPP_REGION,NTC_XMPP_CONT 无表结构 不确定表是不是字符串类 @@ -71,7 +71,11 @@ 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; 38=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:NTC_VOIP_ACCOUNT,NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x27 流媒体协议阻断 39=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:NTC_STREAMING_MEDIA_URL,NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE +#0x28 网页关键字阻断 +40=10:NTC_COMPILE;11:NTC_GROUP;14:NTC_HTTP_REQ_BODY,NTC_HTTP_RES_BODY;18:NTC_IP_RANGE +#0x42 邮件账号白名单 +66=10:NTC_COMPILE;11:NTC_GROUP;15:NTC_MAIL_HDR;18:NTC_IP_RANGE #0x80 IP地址监测 128=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_IP;14:NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE @@ -119,6 +123,8 @@ 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; 150=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:NTC_VOIP_ACCOUNT,NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE #0x97 流媒体协议监测 151=10:NTC_COMPILE;11:NTC_GROUP;12:NTC_UNIVERSAL_IP;13:NTC_UNIVERSAL_PROTO_TYPE;14:NTC_STREAMING_MEDIA_URL,NTC_SUBSCRIBE_ID;18:NTC_IP_RANGE +#0x98 网页关键字监测 +152=10:NTC_COMPILE;11:NTC_GROUP;14:NTC_HTTP_REQ_BODY,NTC_HTTP_RES_BODY;18:NTC_IP_RANGE #0xA0 通联关系监测 monit 无配置 #0xA1 邮件泛收 monit 无配置 @@ -244,6 +250,8 @@ unMaatService=3:32;4:96;5:32;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:1 #0x41 DNS 响应策略配置(回调) 65=0:NTC_DNS_RES_STRATEGY + + #0x105 音频样例阻断 261=0:MM_SAMPLE_AUDIO #0x106 视频样例阻断 @@ -297,8 +305,10 @@ unMaatService=3:32;4:96;5:32;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:1 #APP 0x400-0x420 目前配置入到NTC系统对应的库中 ########## 配置分发 ##MAAT配置 -#0x01 全局IP白名单 1:2,3,4,5; -#0x02 全局域名白名单 2:2,3,4,5; +#0x01 全局IP白名单 1:2,4,5;(杨威说不往ysp库下发了,所以就不往3号库里面写了) +#0x02 全局域名白名单 2:2,4,5;(杨威说不往ysp库下发了,所以就不往3号库里面写了) +#0x42 邮件账号白名单 66:2,4,5;(杨威说不往ysp库下发了,所以就不往3号库里面写了) + #0x21 APP阻断 33:2,5; #0x200 PXY拦截IP 512:4,5; #0x201 PXY拦截域名 513:4,2,5; @@ -307,7 +317,7 @@ unMaatService=3:32;4:96;5:32;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:1 ##回调类配置 #0x340 IP复用地址池配置(回调)832:2,4,5 ########## -serviceDBIndex=1:2,4,5;2:2,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;38:2;39:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;150:2;151:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;273:3;274:5;384:2;385:2;386:2;387:2;388:2;395:2;399:3;512:4,5;513:4,2,5;514:4;515:4;517:4;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;750:4;768:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2;1041:2;1042:2;1152:2;3:5;4:5;5:2;25:5;28:5;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;268:3;269:3;270:3;389:3;390:3;391:3;392:3;393:3;394:3;396:3;397:3;398:3;832:2,4,5; +serviceDBIndex=1:2,4,5;2:2,4,5;66:2,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;38:2;39:2;40:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;150:2;151:2;152:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;273:3;274:5;384:2;385:2;386:2;387:2;388:2;395:2;399:3;512:4,5;513:4,2,5;514:4;515:4;517:4;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;750:4;768:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2;1041:2;1042:2;1152:2;3:5;4:5;5:2;25:5;28:5;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;268:3;269:3;270:3;389:3;390:3;391:3;392:3;393:3;394:3;396:3;397:3;398:3;832:2,4,5; ##阀门配置在redisdb的序号 tapRedisDb=5 diff --git a/src/main/resources/applicationLog-clickhouse.properties b/src/main/resources/applicationLog-clickhouse.properties index 6ecf6a0..2f686b9 100644 --- a/src/main/resources/applicationLog-clickhouse.properties +++ b/src/main/resources/applicationLog-clickhouse.properties @@ -34,6 +34,7 @@ MmSpeakerRecognizationLogClickHouseTable=TBS_ODS_MM_SPEAKER_RECOGNIZATION_LOG NtcVoipLogClickHouseTable=TBS_ODS_NTC_VOIP_LOG NtcStreamingMediaLogClickHouseTable=TBS_ODS_NTC_STREAMING_MEDIA_LOG MmFileDigestLogClickHouseTable=TBS_ODS_MM_FILE_DIGEST_LOG +NtcKeywordsUrlLogClickHouseTable=TBS_ODS_NTC_KEYWORDS_URL_LOG diff --git a/src/main/resources/applicationLog-hive.properties b/src/main/resources/applicationLog-hive.properties index 7a903d2..824f387 100644 --- a/src/main/resources/applicationLog-hive.properties +++ b/src/main/resources/applicationLog-hive.properties @@ -34,6 +34,7 @@ MmSpeakerRecognizationLogHiveTable=MM_SPEAKER_RECOGNIZATION_LOG NtcVoipLogHiveTable=NTC_VOIP_LOG NtcStreamingMediaLogHiveTable=NTC_STREAMING_MEDIA_LOG MmFileDigestLogHiveTable=MM_FILE_DIGEST_LOG +NtcKeywordsUrlLogHiveTable=NTC_KEYWORDS_URL_LOG diff --git a/src/main/resources/maatXml/applicationConfig-maatRedis.xml b/src/main/resources/maatXml/applicationConfig-maatRedis.xml index 5633851..10ba3e7 100644 --- a/src/main/resources/maatXml/applicationConfig-maatRedis.xml +++ b/src/main/resources/maatXml/applicationConfig-maatRedis.xml @@ -198,7 +198,7 @@ + service="1;2;66;16;17;18;19;20;21;22;23;24;26;27;30;31;32;33;34;35;36;37;38;39;40;128;129;130;131;132;133;134;135;136;137;138;139;140;141;142;143;144;145;146;147;148;149;150;151;152;256;257;258;259;260;267;271;272;273;384;385;386;387;388;395;399;512;513;514;515;517;521;528;544;560;576;592;750;768;848;1024;1025;1026;1027;1028;1029;1030;1040;1041;1042;1056;1057;1058;1059;1060;1152"> EFFECTIVE_RULE;:;{compile_table_name};,;[compile_id] [compile_id];\t;[service];\t;[action];\t;[do_blacklist];\t;[do_log];\t;[effective_range];\t;[user_region];\t;[is_valid];\t;[group_num];\t;[father_cfg_id];\t;[op_time]; 0;\n