一、日志接口添加查询条件
ntcAppLogs :searchLabelAppId和searchLabelProtoId ntcBgpLogs :searchAsNum ntcFtpLogs :searchFtpUrl ntcP2pLogs :searchP2pFileId和searchP2pKeyword ntcStreamMediaLogs :searchUrl ntcVoipLogs : searchCallingAccount 和searchCalledAccount; ntcDdosLogs : searchAttackType 二、修改App活跃IP top100查询接口,添加指标(searchQuota: 1:连接数 2:包数 3:字节数,默认为1),返回数据中添加占比
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -26,6 +27,10 @@ public class NtcAppLog extends LogEntity<NtcAppLog> {
|
||||
private Integer labelAppId;
|
||||
@ApiModelProperty(value = "应用来源", required = true)
|
||||
private Integer labelAppSource;
|
||||
|
||||
|
||||
protected String searchLabelAppId;//App Id
|
||||
protected String searchLabelProtoId;//协议类型ID
|
||||
|
||||
public Integer getLabelProtoId() {
|
||||
return labelProtoId;
|
||||
@@ -71,4 +76,20 @@ public class NtcAppLog extends LogEntity<NtcAppLog> {
|
||||
public void setLabelAppSource(Integer labelAppSource) {
|
||||
this.labelAppSource = labelAppSource;
|
||||
}
|
||||
@JsonIgnore
|
||||
public String getSearchLabelAppId() {
|
||||
return searchLabelAppId;
|
||||
}
|
||||
|
||||
public void setSearchLabelAppId(String searchLabelAppId) {
|
||||
this.searchLabelAppId = searchLabelAppId;
|
||||
}
|
||||
@JsonIgnore
|
||||
public String getSearchLabelProtoId() {
|
||||
return searchLabelProtoId;
|
||||
}
|
||||
|
||||
public void setSearchLabelProtoId(String searchLabelProtoId) {
|
||||
this.searchLabelProtoId = searchLabelProtoId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -21,6 +22,8 @@ public class NtcBgpLog extends LogEntity<NtcBgpLog> {
|
||||
@ApiModelProperty(value="路由信息", required=true)
|
||||
protected String route;
|
||||
|
||||
protected String searchAsNum;//ASN号
|
||||
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
@@ -40,4 +43,12 @@ public class NtcBgpLog extends LogEntity<NtcBgpLog> {
|
||||
return route;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchAsNum() {
|
||||
return searchAsNum;
|
||||
}
|
||||
|
||||
public void setSearchAsNum(String searchAsNum) {
|
||||
this.searchAsNum = searchAsNum;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.nis.domain.restful;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -33,6 +34,8 @@ public class NtcDdosLog extends LogEntity<NtcDdosLog> {
|
||||
protected Integer isBlock;
|
||||
|
||||
protected String searchIsBlock; //攻击流量是否被丢弃
|
||||
protected String searchAttackType; //攻击类型
|
||||
|
||||
public Integer getAttackType() {
|
||||
return attackType;
|
||||
}
|
||||
@@ -82,6 +85,7 @@ public class NtcDdosLog extends LogEntity<NtcDdosLog> {
|
||||
this.isBlock = isBlock;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchIsBlock() {
|
||||
return searchIsBlock;
|
||||
}
|
||||
@@ -89,4 +93,13 @@ public class NtcDdosLog extends LogEntity<NtcDdosLog> {
|
||||
public void setSearchIsBlock(String searchIsBlock) {
|
||||
this.searchIsBlock = searchIsBlock;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchAttackType() {
|
||||
return searchAttackType;
|
||||
}
|
||||
|
||||
public void setSearchAttackType(String searchAttackType) {
|
||||
this.searchAttackType = searchAttackType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -17,7 +18,8 @@ public class NtcFtpLog extends LogEntity {
|
||||
@ApiModelProperty(value = "FTP内容", required = true)
|
||||
protected String ftpContent;
|
||||
|
||||
|
||||
protected String searchFtpUrl;
|
||||
|
||||
public String getFtpUrl() {
|
||||
return ftpUrl;
|
||||
}
|
||||
@@ -33,4 +35,12 @@ public class NtcFtpLog extends LogEntity {
|
||||
public void setFtpContent(String ftpContent) {
|
||||
this.ftpContent = ftpContent;
|
||||
}
|
||||
@JsonIgnore
|
||||
public String getSearchFtpUrl() {
|
||||
return searchFtpUrl;
|
||||
}
|
||||
|
||||
public void setSearchFtpUrl(String searchFtpUrl) {
|
||||
this.searchFtpUrl = searchFtpUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -22,6 +23,8 @@ public class NtcP2pLog extends LogEntity<NtcP2pLog> {
|
||||
@ApiModelProperty(value = "Emule搜索关键词", required = true)
|
||||
private String p2pKeyword;
|
||||
|
||||
protected String searchP2pFileId;
|
||||
protected String searchP2pKeyword;
|
||||
/**
|
||||
* @return the p2pProto
|
||||
*/
|
||||
@@ -58,4 +61,22 @@ public class NtcP2pLog extends LogEntity<NtcP2pLog> {
|
||||
public void setP2pKeyword(String p2pKeyword) {
|
||||
this.p2pKeyword = p2pKeyword;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchP2pFileId() {
|
||||
return searchP2pFileId;
|
||||
}
|
||||
|
||||
public void setSearchP2pFileId(String searchP2pFileId) {
|
||||
this.searchP2pFileId = searchP2pFileId;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchP2pKeyword() {
|
||||
return searchP2pKeyword;
|
||||
}
|
||||
|
||||
public void setSearchP2pKeyword(String searchP2pKeyword) {
|
||||
this.searchP2pKeyword = searchP2pKeyword;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -16,6 +17,8 @@ public class NtcStreamingMediaLog extends LogEntity<NtcStreamingMediaLog> {
|
||||
protected String url;
|
||||
@ApiModelProperty(value="传输协议", required=true)
|
||||
protected String protocol;
|
||||
|
||||
protected String searchUrl;
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
@@ -28,4 +31,13 @@ public class NtcStreamingMediaLog extends LogEntity<NtcStreamingMediaLog> {
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchUrl() {
|
||||
return searchUrl;
|
||||
}
|
||||
|
||||
public void setSearchUrl(String searchUrl) {
|
||||
this.searchUrl = searchUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.nis.domain.LogEntity;
|
||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@@ -25,6 +26,9 @@ public class NtcVoipLog extends LogEntity<NtcVoipLog> {
|
||||
protected String callingNumber;
|
||||
@ApiModelProperty(value="VOIP被叫电信号码", required=true)
|
||||
protected String calledNumber;
|
||||
|
||||
protected String searchCallingAccount;
|
||||
protected String searchCalledAccount;
|
||||
/**
|
||||
* @return the voipProtocol
|
||||
*/
|
||||
@@ -67,4 +71,21 @@ public class NtcVoipLog extends LogEntity<NtcVoipLog> {
|
||||
public void setCalledNumber(String calledNumber) {
|
||||
this.calledNumber = calledNumber;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchCalledAccount() {
|
||||
return searchCalledAccount;
|
||||
}
|
||||
|
||||
public void setSearchCalledAccount(String searchCalledAccount) {
|
||||
this.searchCalledAccount = searchCalledAccount;
|
||||
}
|
||||
@JsonIgnore
|
||||
public String getSearchCallingAccount() {
|
||||
return searchCallingAccount;
|
||||
}
|
||||
|
||||
public void setSearchCallingAccount(String searchCallingAccount) {
|
||||
this.searchCallingAccount = searchCallingAccount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,44 +5,94 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
public class AppConnRecordStatistic extends AppTrendEntity{
|
||||
|
||||
protected String ipAddr;
|
||||
protected String pktNum;
|
||||
protected String byteNum;
|
||||
protected String logNum; //日志数量
|
||||
protected Double pktNum;
|
||||
protected String pktPercent;
|
||||
protected Double byteNum;
|
||||
protected String bytePercent;
|
||||
protected Double logNum; //日志数量
|
||||
protected String logPercent;
|
||||
protected String searchQuota="1"; //统计指标 1:连接数 2:包数 3:字节数
|
||||
|
||||
public AppConnRecordStatistic() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
public AppConnRecordStatistic(String ipAddr, String pktNum, String byteNum,
|
||||
String logNum) {
|
||||
|
||||
public AppConnRecordStatistic(String ipAddr, Double pktNum,
|
||||
String pktPercent, Double byteNum, String bytePercent,
|
||||
Double logNum, String logPercent) {
|
||||
super();
|
||||
this.ipAddr = ipAddr;
|
||||
this.pktNum = pktNum;
|
||||
this.pktPercent = pktPercent;
|
||||
this.byteNum = byteNum;
|
||||
this.bytePercent = bytePercent;
|
||||
this.logNum = logNum;
|
||||
this.logPercent = logPercent;
|
||||
}
|
||||
|
||||
public String getIpAddr() {
|
||||
return ipAddr;
|
||||
}
|
||||
public void setIpAddr(String ipAddr) {
|
||||
this.ipAddr = ipAddr;
|
||||
}
|
||||
public String getPktNum() {
|
||||
|
||||
public Double getPktNum() {
|
||||
return pktNum;
|
||||
}
|
||||
public void setPktNum(String pktNum) {
|
||||
|
||||
public void setPktNum(Double pktNum) {
|
||||
this.pktNum = pktNum;
|
||||
}
|
||||
public String getByteNum() {
|
||||
|
||||
public String getPktPercent() {
|
||||
return pktPercent;
|
||||
}
|
||||
|
||||
public void setPktPercent(String pktPercent) {
|
||||
this.pktPercent = pktPercent;
|
||||
}
|
||||
|
||||
public Double getByteNum() {
|
||||
return byteNum;
|
||||
}
|
||||
public void setByteNum(String byteNum) {
|
||||
|
||||
public void setByteNum(Double byteNum) {
|
||||
this.byteNum = byteNum;
|
||||
}
|
||||
public String getLogNum() {
|
||||
|
||||
public String getBytePercent() {
|
||||
return bytePercent;
|
||||
}
|
||||
|
||||
public void setBytePercent(String bytePercent) {
|
||||
this.bytePercent = bytePercent;
|
||||
}
|
||||
|
||||
public Double getLogNum() {
|
||||
return logNum;
|
||||
}
|
||||
public void setLogNum(String logNum) {
|
||||
|
||||
public void setLogNum(Double logNum) {
|
||||
this.logNum = logNum;
|
||||
}
|
||||
|
||||
public String getLogPercent() {
|
||||
return logPercent;
|
||||
}
|
||||
|
||||
public void setLogPercent(String logPercent) {
|
||||
this.logPercent = logPercent;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getSearchQuota() {
|
||||
return searchQuota;
|
||||
}
|
||||
|
||||
public void setSearchQuota(String searchQuota) {
|
||||
this.searchQuota = searchQuota;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,4 +17,5 @@ public interface TrafficAppStatisticDao {
|
||||
List<Map> getAppList(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("appType")Integer[] appType);
|
||||
List<TrafficAppFocusStatistic> getAppTrend(TrafficAppFocusStatistic entity);
|
||||
List<AppConnRecordStatistic> appConnRecordTop100(AppConnRecordStatistic entity);
|
||||
List<AppConnRecordStatistic> appConnRecordTotal(AppConnRecordStatistic entity);
|
||||
}
|
||||
@@ -46,24 +46,40 @@
|
||||
<select id="getAppTrend" parameterType="com.nis.domain.restful.dashboard.TrafficAppFocusStatistic" resultType="com.nis.domain.restful.dashboard.TrafficAppFocusStatistic">
|
||||
select stat_time time, max(unique_sip_num) sipNum,max(unique_dip_num) dipNum from traffic_app_focus_statistic t where
|
||||
<![CDATA[ stat_time>= toDateTime(#{searchStartTime}) and stat_time< toDateTime(#{searchEndTime})
|
||||
and app_id=toInt64(#{searchAppId}) ]]>
|
||||
<if test="searchEntranceId">
|
||||
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
||||
</if>
|
||||
|
||||
and app_id=toInt64(#{searchAppId}) and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
||||
group by stat_time
|
||||
order by stat_time
|
||||
</select>
|
||||
<!-- App通联关系Top100 -->
|
||||
<!-- App 活跃IP Top100 -->
|
||||
<select id="appConnRecordTop100" parameterType="com.nis.domain.restful.dashboard.AppConnRecordStatistic" resultType="com.nis.domain.restful.dashboard.AppConnRecordStatistic">
|
||||
select s_ip ipAddr, sum(c2s_byte_num + s2c_byte_num) byteNum, sum(c2s_pkt_num + s2c_pkt_num) pktNum, count(s_ip) logNum
|
||||
from tbs_ods_ntc_conn_record_log t where
|
||||
<![CDATA[ found_time>= toDateTime(#{searchStartTime}) and found_time< toDateTime(#{searchEndTime})
|
||||
and app_id=toInt64(#{searchAppId}) and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
||||
group by s_ip
|
||||
order by
|
||||
<choose>
|
||||
<when test="searchQuota !=null and searchQuota != '' and searchQuota == 2 ">
|
||||
pktNum
|
||||
</when>
|
||||
<when test="searchQuota !=null and searchQuota != '' and searchQuota == 3 ">
|
||||
byteNum
|
||||
</when>
|
||||
<otherwise>
|
||||
logNum
|
||||
</otherwise>
|
||||
</choose>
|
||||
desc limit 100
|
||||
</select>
|
||||
<!-- App 所有IP 连接数、包数、字节数 总量统计 用于计算活跃IP Top100的占比情况 -->
|
||||
<select id="appConnRecordTotal" parameterType="com.nis.domain.restful.dashboard.AppConnRecordStatistic" resultType="com.nis.domain.restful.dashboard.AppConnRecordStatistic">
|
||||
select sum(c2s_byte_num + s2c_byte_num) byteNum, sum(c2s_pkt_num + s2c_pkt_num) pktNum, count(s_ip) logNum
|
||||
from tbs_ods_ntc_conn_record_log t where
|
||||
<![CDATA[ found_time>= toDateTime(#{searchStartTime}) and found_time< toDateTime(#{searchEndTime})
|
||||
and app_id=toInt64(#{searchAppId}) ]]>
|
||||
<if test="searchEntranceId">
|
||||
<if test="searchEntranceId !=null and searchEntranceId != ''">
|
||||
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
||||
</if>
|
||||
group by s_ip
|
||||
order by logNum desc limit 100
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -250,7 +250,7 @@ public class LogDataService {
|
||||
String field = filedAndColumnMap.get(key).toLowerCase();
|
||||
if (type.equals("java.lang.String")) {
|
||||
|
||||
if (field.equals("url") || field.equals("website")) {
|
||||
if (field.contains("url") || field.equals("website")) {
|
||||
whereSB.append(" and " + field + " like '"
|
||||
+ StringEscapeUtils.unescapeHtml4(value.toString().trim()) + "%'");
|
||||
} else if (field.equals("client_locate") || field.equals("server_locate")) {
|
||||
@@ -407,7 +407,7 @@ public class LogDataService {
|
||||
|
||||
if (typeName.equals("java.lang.String")) {
|
||||
String field = filedAndColumnMap.get(key);
|
||||
if (field.equals("url") || field.equals("website")) {
|
||||
if (field.contains("url") || field.equals("website")) {
|
||||
whereSB.append(" and " + field + " like '"
|
||||
+ StringEscapeUtils.unescapeHtml4(value.toString().trim()) + "%'");
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.nis.web.service.restful;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -15,6 +16,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -565,7 +567,7 @@ public class DashboardService extends BaseService {
|
||||
int index = 0;
|
||||
for (int i = 0; i < dateRangeList.size(); i++) {
|
||||
// 存放一个时间点中每个IP的总数
|
||||
Map<String, Long> ipCountMap = new HashMap<String, Long>();
|
||||
Map<String, Long> ipCountMap = new TreeMap<String, Long>();
|
||||
Date date = dateRangeList.get(i);
|
||||
for (int j = index; j < ipInfoList.size(); j++) {
|
||||
TrafficIpActiveStatistic ipInfo = ipInfoList.get(j);
|
||||
@@ -1695,8 +1697,18 @@ public class DashboardService extends BaseService {
|
||||
}
|
||||
|
||||
public List<AppConnRecordStatistic> appConnRecordTop100(AppConnRecordStatistic entity) {
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
List<AppConnRecordStatistic> list = new ArrayList<AppConnRecordStatistic>();
|
||||
list = trafficAppStatisticDao.appConnRecordTop100(entity);
|
||||
if (!StringUtil.isEmpty(list)) {
|
||||
//统计总量
|
||||
AppConnRecordStatistic sum = trafficAppStatisticDao.appConnRecordTotal(entity).get(0);
|
||||
for (AppConnRecordStatistic obj : list) {
|
||||
obj.setBytePercent(df.format(obj.getByteNum()/sum.getByteNum()*100));
|
||||
obj.setPktPercent(df.format(obj.getPktNum()/sum.getPktNum()*100));
|
||||
obj.setLogPercent(df.format(obj.getLogNum()/sum.getLogNum()*100));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user