服务访问日志也支持分表查询

This commit is contained in:
GoEdgeLab
2022-04-17 17:08:39 +08:00
parent 35d9e2d492
commit eb79271096
5 changed files with 18 additions and 9 deletions

View File

@@ -53,6 +53,7 @@ func (this *HistoryAction) RunGet(params struct {
this.Data["pageSize"] = params.PageSize
this.Data["clusterId"] = params.ClusterId
this.Data["nodeId"] = params.NodeId
this.Data["partition"] = params.Partition
day := params.Day
ipList := []string{}

View File

@@ -46,6 +46,8 @@ func (this *TodayAction) RunGet(params struct {
this.Data["hasWAF"] = params.HasWAF
this.Data["clusterId"] = params.ClusterId
this.Data["nodeId"] = params.NodeId
this.Data["partition"] = params.Partition
this.Data["day"] = timeutil.Format("Ymd")
resp, err := this.RPC().HTTPAccessLogRPC().ListHTTPAccessLogs(this.AdminContext(), &pb.ListHTTPAccessLogsRequest{
Partition: params.Partition,

View File

@@ -31,10 +31,10 @@ Vue.component("http-access-log-partitions-box", {
methods: {
url: function (p) {
let u = window.location.toString()
u = u.replace(/\?partition=\d+/, "?")
u = u.replace(/\?requestId=\d+/, "?")
u = u.replace(/&partition=\d+/, "")
u = u.replace(/&requestId=\d+/, "")
u = u.replace(/\?partition=-?\d+/, "?")
u = u.replace(/\?requestId=-?\d+/, "?")
u = u.replace(/&partition=-?\d+/, "")
u = u.replace(/&requestId=-?\d+/, "")
if (u.indexOf("?") > 0) {
u += "&partition=" + p
} else {
@@ -53,7 +53,7 @@ Vue.component("http-access-log-partitions-box", {
template: `<div v-if="partitions.length > 1">
<div class="ui divider" style="margin-bottom: 0"></div>
<div class="ui menu text small blue" style="margin-bottom: 0; margin-top: 0">
<a v-for="p in partitions" :href="url(p.code)" class="item" :class="{active: selectedPartition == p.code, disabled: p.isDisabled}">分表{{p.code}}</a>
<a v-for="(p, index) in partitions" :href="url(p.code)" class="item" :class="{active: selectedPartition == p.code, disabled: p.isDisabled}">分表{{p.code+1}} &nbsp; &nbsp; <span class="disabled" v-if="index != partitions.length - 1">|</span></a>
</div>
<div class="ui divider" style="margin-top: 0"></div>
</div>`

View File

@@ -37,6 +37,9 @@
</http-access-log-search-box>
</form>
<!-- 分区 -->
<http-access-log-partitions-box :v-day="day" :v-partition="partition"></http-access-log-partitions-box>
<p class="comment" v-if="accessLogs.length == 0">暂时还没有访问日志。</p>
<table class="ui table selectable" v-if="accessLogs.length > 0">
@@ -47,10 +50,10 @@
</table>
<div v-if="accessLogs.length > 0">
<a :href="path + '?serverId=' + serverId + '&requestId=' + lastRequestId + '&day=' + day + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain + '&hour=' + hour + '&pageSize=' + pageSize" v-if="hasPrev">上一页</a>
<a :href="path + '?serverId=' + serverId + '&requestId=' + lastRequestId + '&day=' + day + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain + '&hour=' + hour + '&pageSize=' + pageSize + '&partition=' + partition" v-if="hasPrev">上一页</a>
<span v-else class="disabled">上一页</span>
<span class="disabled">&nbsp; | &nbsp;</span>
<a :href="path + '?serverId=' + serverId + '&requestId=' + nextRequestId + '&day=' + day + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain + '&hour=' + hour + '&pageSize=' + pageSize" v-if="hasMore">下一页</a>
<a :href="path + '?serverId=' + serverId + '&requestId=' + nextRequestId + '&day=' + day + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain + '&hour=' + hour + '&pageSize=' + pageSize + '&partition=' + partition" v-if="hasMore">下一页</a>
<span v-else class="disabled">下一页</span>
<page-size-selector></page-size-selector>
</div>

View File

@@ -25,6 +25,9 @@
<http-access-log-search-box :v-ip="ip" :v-domain="domain" :v-keyword="keyword" :v-cluster-id="clusterId" :v-node-id="nodeId"></http-access-log-search-box>
</form>
<!-- 分区 -->
<http-access-log-partitions-box :v-day="day" :v-partition="partition"></http-access-log-partitions-box>
<p class="comment" v-if="accessLogs.length == 0">今天暂时还没有访问日志。</p>
<table class="ui table selectable" v-if="accessLogs.length > 0">
@@ -35,10 +38,10 @@
</table>
<div v-if="accessLogs.length > 0">
<a :href="path + '?serverId=' + serverId + '&requestId=' + lastRequestId + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain + '&pageSize=' + pageSize" v-if="hasPrev">上一页</a>
<a :href="path + '?serverId=' + serverId + '&requestId=' + lastRequestId + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain + '&pageSize=' + pageSize + '&partition=' + partition" v-if="hasPrev">上一页</a>
<span v-else class="disabled">上一页</span>
<span class="disabled">&nbsp; | &nbsp;</span>
<a :href="path + '?serverId=' + serverId + '&requestId=' + nextRequestId + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain + '&pageSize=' + pageSize" v-if="hasMore">下一页</a>
<a :href="path + '?serverId=' + serverId + '&requestId=' + nextRequestId + '&hasError=' + hasError + '&hasWAF=' + hasWAF + '&keyword=' + keyword + '&ip=' + ip + '&domain=' + domain + '&pageSize=' + pageSize + '&partition=' + partition" v-if="hasMore">下一页</a>
<span v-else class="disabled">下一页</span>
<page-size-selector></page-size-selector>
</div>