diff --git a/src/main/java/com/nis/domain/log/PxyHttpLog.java b/src/main/java/com/nis/domain/log/PxyHttpLog.java new file mode 100644 index 000000000..ef602167b --- /dev/null +++ b/src/main/java/com/nis/domain/log/PxyHttpLog.java @@ -0,0 +1,112 @@ +package com.nis.domain.log; + +public class PxyHttpLog extends BaseLogEntity { + + private static final long serialVersionUID = -3046458130302949428L; + + private String url; + private String reqLine; + private String resLine; + private String cookie; + private String referer; + private String userAgent; + private String contentLen; + private String contentType; + private String setCookie; + private String reqHeader; + private String respHeader; + private String reqBody; + private String resBody; + + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getReqLine() { + return reqLine; + } + public void setReqLine(String reqLine) { + this.reqLine = reqLine; + } + public String getResLine() { + return resLine; + } + public void setResLine(String resLine) { + this.resLine = resLine; + } + public String getCookie() { + return cookie; + } + public void setCookie(String cookie) { + this.cookie = cookie; + } + public String getReferer() { + return referer; + } + public void setReferer(String referer) { + this.referer = referer; + } + public String getUserAgent() { + return userAgent; + } + public void setUserAgent(String userAgent) { + this.userAgent = userAgent; + } + public String getContentLen() { + return contentLen; + } + public void setContentLen(String contentLen) { + this.contentLen = contentLen; + } + public String getContentType() { + return contentType; + } + public void setContentType(String contentType) { + this.contentType = contentType; + } + public String getSetCookie() { + return setCookie; + } + public void setSetCookie(String setCookie) { + this.setCookie = setCookie; + } + public String getReqHeader() { + return reqHeader; + } + public void setReqHeader(String reqHeader) { + this.reqHeader = reqHeader; + } + public String getRespHeader() { + return respHeader; + } + public void setRespHeader(String respHeader) { + this.respHeader = respHeader; + } + public String getReqBody() { + return reqBody; + } + public void setReqBody(String reqBody) { + this.reqBody = reqBody; + } + public String getResBody() { + return resBody; + } + public void setResBody(String resBody) { + this.resBody = resBody; + } + @Override + public String toString() { + return "{\"url\"=\"" + url + "\", \"reqLine\"=\"" + reqLine + + "\", \"resLine\"=\"" + resLine + "\", \"cookie\"=\"" + cookie + + "\", \"referer\"=\"" + referer + "\", \"userAgent\"=\"" + + userAgent + "\", \"contentLen\"=\"" + contentLen + + "\", \"contentType\"=\"" + contentType + + "\", \"setCookie\"=\"" + setCookie + "\", \"reqHeader\"=\"" + + reqHeader + "\", \"respHeader\"=\"" + respHeader + + "\", \"reqBody\"=\"" + reqBody + "\", \"resBody\"=\"" + + resBody + "\"}"; + } + +} diff --git a/src/main/java/com/nis/util/Constants.java b/src/main/java/com/nis/util/Constants.java index aa873d368..b1c33827c 100644 --- a/src/main/java/com/nis/util/Constants.java +++ b/src/main/java/com/nis/util/Constants.java @@ -417,6 +417,7 @@ public final class Constants { public static final String NTC_MMPORNVIDEOLEVEL_LOG = Configurations.getStringProperty("mmPornVideoLevelLog", ""); public static final String NTC_MMSAMPLEPIC_LOG = Configurations.getStringProperty("mmSamplePicLog", ""); public static final String NTC_MMSAMPLEVOIP_LOG = Configurations.getStringProperty("mmSampleVoipLog", ""); + public static final String PXY_HTTP_LOG = Configurations.getStringProperty("pxyHttpLog", ""); //报表类型,1- 配置命中总量业务 public static final Integer BUSINESSTYPE_CONFIG=Configurations.getIntProperty("businesstype_config", 1); diff --git a/src/main/java/com/nis/web/controller/log/pxy/PxyHttpLogController.java b/src/main/java/com/nis/web/controller/log/pxy/PxyHttpLogController.java new file mode 100644 index 000000000..6bf1c60be --- /dev/null +++ b/src/main/java/com/nis/web/controller/log/pxy/PxyHttpLogController.java @@ -0,0 +1,94 @@ +package com.nis.web.controller.log.pxy; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.support.RequestContext; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import com.nis.domain.PageLog; +import com.nis.domain.log.PxyHttpLog; +import com.nis.domain.maat.LogRecvData; +import com.nis.util.Constants; +import com.nis.util.httpclient.HttpClientUtil; +import com.nis.web.controller.BaseController; + +@Controller +@RequestMapping("${adminPath}/log/pxy") +public class PxyHttpLogController extends BaseController { + + @RequestMapping(value = {"list", "ipInterceptlogs", "domainInterceptlogs", "httpBlocklogs", + "httpRedirectlogs", "httpReplacelogs", "httpMonitogs"}) + public String list(@ModelAttribute("log") PxyHttpLog log, Model model, HttpServletRequest request, HttpServletResponse response) { + try { + setLogInfo(request, model, log); + + PageLog page = new PageLog(request, response); + Map params = new HashMap(); + params.put("pageSize", page.getPageSize()); + params.put("pageNo", page.getPageNo()); + + initLogSearchValue(log, params); + + String url = Constants.LOG_BASE_URL + Constants.PXY_HTTP_LOG; + String recv = HttpClientUtil.getMsg(url, params, request); + logger.info("查询结果:" + recv); + + Gson gson = new GsonBuilder().create(); + + LogRecvData fromJson = gson.fromJson(recv, new TypeToken>(){}.getType()); + if (fromJson.getStatus().intValue() == 200) { + page.setList(fromJson.getData().getList()); + List list = page.getList(); + for (PxyHttpLog l : list) { + l.setFunctionId(log.getFunctionId()); + setLogAction(l); + } + model.addAttribute("page", page); + } + + } catch (Exception e) { + logger.error("查询失败", e); + addMessage(model, e.getMessage()); + } + + return "/log/pxy/pxyHttpList"; + } + + private void setLogInfo(HttpServletRequest request, Model model, PxyHttpLog log) { + int functionId = log.getFunctionId(); + + RequestContext requestContext = new RequestContext(request); + + if (functionId == 200) { + model.addAttribute("logTitle", requestContext.getMessage("ip_intercept")); + log.setAction(1); + } else if (functionId == 201) { + model.addAttribute("logTitle", requestContext.getMessage("domain_intercept")); + log.setAction(1); + } else if (functionId == 207) { + model.addAttribute("logTitle", requestContext.getMessage("http_block")); + log.setAction(16); + } else if (functionId == 208) { + model.addAttribute("logTitle", requestContext.getMessage("http_redirect")); + log.setAction(48); + } else if (functionId == 209) { + model.addAttribute("logTitle", requestContext.getMessage("http_replace")); + log.setAction(80); + } else if (functionId == 210) { + model.addAttribute("logTitle", requestContext.getMessage("http_monit")); + log.setAction(1); + } + } +} diff --git a/src/main/resources/nis.properties b/src/main/resources/nis.properties index 85ac083f7..4c57a83a1 100644 --- a/src/main/resources/nis.properties +++ b/src/main/resources/nis.properties @@ -262,6 +262,7 @@ mmPornAudioLevelLog=mmPornAudioLevelLogs mmPornVideoLevelLog=mmPornVideoLevelLogs mmSamplePicLog=mmSamplePicLogs mmSampleVoipLog=mmSampleVoipLogs +pxyHttpLog=pxyHttpLogs ######################################## #大屏图表展示服务接口 dashboardUrl=http://10.0.6.101:8080/galaxy/service/log/v1/ @@ -395,7 +396,7 @@ digest_single_file_max_size=10485760 digest_total_file_max_size=12582912 #YSP文件保存路径 #av_file_path=/home/ysp/ -av_file_path=D:\\ysp\\ +av_file_path=D\:\\ysp\\ #YSP文件特征类型 av_sample_audio_region=av_sample_audio av_sample_video_region=av_sample_video @@ -411,9 +412,9 @@ av_sample_voip_region=av_sample_voip #audio_sample_proc_param_is_translation=false #video_sample_proc_param_is_translation=false #picture_sample_proc_param_is_translation=false -audio_sample_create_proc=java -jar D:\\sampleTest.jar -video_sample_create_proc=java -jar D:\\sampleTest.jar -picture_sample_create_proc=java -jar D:\\sampleTest.jar +audio_sample_create_proc=java -jar D\:\\sampleTest.jar +video_sample_create_proc=java -jar D\:\\sampleTest.jar +picture_sample_create_proc=java -jar D\:\\sampleTest.jar audio_sample_proc_param_is_quotation=false video_sample_proc_param_is_quotation=false picture_sample_proc_param_is_quotation=false diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmPornAudioSampleList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmPornAudioSampleList.jsp index 16fa82db9..def4e881e 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmPornAudioSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmPornAudioSampleList.jsp @@ -207,15 +207,32 @@ $(document).ready(function(){ ${log.pid} - ${log.url } - http://${log.url } + <%-- ${log.url } + http://${log.url } --%> + + + + + + + + ${fns:stringFormat(url,30)} + - http://${log.logUri } + + + + + + + + ${fns:stringFormat(logUri,30)} + + <%-- ${log.logUri } + http://${log.logUri }'>http://${log.logUri } --%> - ${log.refer} + ${fns:stringFormat(log.refer,30)} ${log.level} @@ -247,7 +264,7 @@ $(document).ready(function(){ - ${log.addrList} + ${fns:stringFormat(log.addrList,30)} ${log.serverLocate} ${log.clientLocate} diff --git a/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp b/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp index e23590cf1..52cc098bb 100644 --- a/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp +++ b/src/main/webapp/WEB-INF/views/log/ntc/mmPornVideoSampleList.jsp @@ -207,13 +207,30 @@ $(document).ready(function(){ ${log.pid} - ${log.url } - http://${log.url } + <%-- ${log.url } + http://${log.url } --%> + + + + + + + + ${fns:stringFormat(url,30)} + - http://${log.logUri } + + + + + + + + ${fns:stringFormat(logUri,30)} + + <%-- ${log.logUri } + http://${log.logUri }'>http://${log.logUri } --%> ${log.refer} ${log.level} @@ -247,7 +264,7 @@ $(document).ready(function(){ - ${log.addrList} + ${fns:stringFormat(log.addrList,30)} ${log.serverLocate} ${log.clientLocate} diff --git a/src/main/webapp/WEB-INF/views/log/pxy/pxyHttpList.jsp b/src/main/webapp/WEB-INF/views/log/pxy/pxyHttpList.jsp new file mode 100644 index 000000000..9fc878c45 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/log/pxy/pxyHttpList.jsp @@ -0,0 +1,215 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + ${logTitle }<spring:message code="log"/> + + + + + +
+ +

+ ${logTitle } + +

+ +
+
+
+
+ + + + + + + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ + + +
+ +
+ + + +
+
+
+
+ + + + + + + +
+
+ +
+
+ + + + + + + +
+
+ +
+
+ + + + + + + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
url
${_log.cfgId }${_log.foundTime }${_log.entranceId }${_log.capIp }${_log.transProto }${_log.dIp }${_log.sIp }${_log.dPort }${_log.sPort } + ${fns:stringFormat(_log.url,30)} + + + + + + + + + + + ${streamType.itemValue} + + + ${fns:stringFormat(_log.addrList,30)} + ${fns:abbr(_log.serverLocate,20)}${fns:abbr(_log.clientLocate,20)}
+
${page}
+
+
+
+
+
+ + \ No newline at end of file