From 98f8fb3bec17c9a68ba3f77bc1c039ea9f914b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 4 Jun 2021 10:15:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E8=AE=BF=E9=97=AE=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=A2=9E=E5=8A=A0=E5=85=B3=E9=94=AE=E8=AF=8D=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/servers/server/log/history.go | 4 ++++ .../default/servers/server/log/index.go | 5 ++++ .../default/servers/server/log/today.go | 3 +++ .../components/server/http-access-log-box.js | 4 ++-- .../@default/servers/server/log/history.html | 13 ++++++---- .../@default/servers/server/log/index.html | 18 +++++++++++++- .../@default/servers/server/log/today.html | 24 +++++++++++++++---- 7 files changed, 58 insertions(+), 13 deletions(-) diff --git a/internal/web/actions/default/servers/server/log/history.go b/internal/web/actions/default/servers/server/log/history.go index 0d38b541..e7e395a3 100644 --- a/internal/web/actions/default/servers/server/log/history.go +++ b/internal/web/actions/default/servers/server/log/history.go @@ -21,6 +21,7 @@ func (this *HistoryAction) Init() { func (this *HistoryAction) RunGet(params struct { ServerId int64 Day string + Keyword string RequestId string HasError int @@ -31,6 +32,7 @@ func (this *HistoryAction) RunGet(params struct { this.Data["path"] = this.Request.URL.Path this.Data["day"] = params.Day + this.Data["keyword"] = params.Keyword this.Data["accessLogs"] = []interface{}{} this.Data["hasError"] = params.HasError @@ -48,6 +50,7 @@ func (this *HistoryAction) RunGet(params struct { ServerId: params.ServerId, HasError: params.HasError > 0, Day: day, + Keyword: params.Keyword, Size: size, }) if err != nil { @@ -80,6 +83,7 @@ func (this *HistoryAction) RunGet(params struct { ServerId: params.ServerId, HasError: params.HasError > 0, Day: day, + Keyword: params.Keyword, Size: size, Reverse: true, }) diff --git a/internal/web/actions/default/servers/server/log/index.go b/internal/web/actions/default/servers/server/log/index.go index e15a6405..ec0790a7 100644 --- a/internal/web/actions/default/servers/server/log/index.go +++ b/internal/web/actions/default/servers/server/log/index.go @@ -20,9 +20,12 @@ func (this *IndexAction) Init() { func (this *IndexAction) RunGet(params struct { ServerId int64 RequestId string + Keyword string }) { this.Data["serverId"] = params.ServerId this.Data["requestId"] = params.RequestId + this.Data["keyword"] = params.Keyword + this.Data["path"] = this.Request.URL.Path // 记录最近使用 _, err := this.RPC().LatestItemRPC().IncreaseLatestItem(this.AdminContext(), &pb.IncreaseLatestItemRequest{ @@ -40,6 +43,7 @@ func (this *IndexAction) RunGet(params struct { func (this *IndexAction) RunPost(params struct { ServerId int64 RequestId string + Keyword string Must *actions.Must }) { @@ -49,6 +53,7 @@ func (this *IndexAction) RunPost(params struct { RequestId: params.RequestId, Size: 20, Day: timeutil.Format("Ymd"), + Keyword: params.Keyword, Reverse: isReverse, }) if err != nil { diff --git a/internal/web/actions/default/servers/server/log/today.go b/internal/web/actions/default/servers/server/log/today.go index 0343ad1d..008d4720 100644 --- a/internal/web/actions/default/servers/server/log/today.go +++ b/internal/web/actions/default/servers/server/log/today.go @@ -20,17 +20,20 @@ func (this *TodayAction) RunGet(params struct { RequestId string ServerId int64 HasError int + Keyword string }) { size := int64(10) this.Data["path"] = this.Request.URL.Path this.Data["hasError"] = params.HasError + this.Data["keyword"] = params.Keyword resp, err := this.RPC().HTTPAccessLogRPC().ListHTTPAccessLogs(this.AdminContext(), &pb.ListHTTPAccessLogsRequest{ RequestId: params.RequestId, ServerId: params.ServerId, HasError: params.HasError > 0, Day: timeutil.Format("Ymd"), + Keyword: params.Keyword, Size: size, }) if err != nil { diff --git a/web/public/js/components/server/http-access-log-box.js b/web/public/js/components/server/http-access-log-box.js index af02bf45..ac239342 100644 --- a/web/public/js/components/server/http-access-log-box.js +++ b/web/public/js/components/server/http-access-log-box.js @@ -1,5 +1,5 @@ Vue.component("http-access-log-box", { - props: ["v-access-log"], + props: ["v-access-log", "v-keyword"], data: function () { let accessLog = this.vAccessLog if (accessLog.header != null && accessLog.header.Upgrade != null && accessLog.header.Upgrade.values != null && accessLog.header.Upgrade.values.$contains("websocket")) { @@ -48,7 +48,7 @@ Vue.component("http-access-log-box", { } }, template: `
- [{{accessLog.region}}] {{accessLog.remoteAddr}} [{{accessLog.timeLocal}}] "{{accessLog.requestMethod}} {{accessLog.scheme}}://{{accessLog.host}}{{accessLog.requestURI}} {{accessLog.proto}}" {{accessLog.status}} cache hit waf {{accessLog.attrs['waf.action']}} - 耗时:{{formatCost(accessLog.requestTime)}} ms + [{{accessLog.region}}] {{accessLog.remoteAddr}} [{{accessLog.timeLocal}}] "{{accessLog.requestMethod}} {{accessLog.scheme}}://{{accessLog.host}}{{accessLog.requestURI}} {{accessLog.proto}}" {{accessLog.status}} cache hit waf {{accessLog.attrs['waf.action']}} - 耗时:{{formatCost(accessLog.requestTime)}} ms  
` }) \ No newline at end of file diff --git a/web/views/@default/servers/server/log/history.html b/web/views/@default/servers/server/log/history.html index 27916daf..744b82f0 100644 --- a/web/views/@default/servers/server/log/history.html +++ b/web/views/@default/servers/server/log/history.html @@ -13,12 +13,15 @@
- 所有日志 - 错误日志 + 所有日志 + 错误日志
+
+ +
@@ -35,15 +38,15 @@ - +
- 上一页 + 上一页 上一页   |   - 下一页 + 下一页 下一页
\ No newline at end of file diff --git a/web/views/@default/servers/server/log/index.html b/web/views/@default/servers/server/log/index.html index 50ba3655..77e3ed95 100644 --- a/web/views/@default/servers/server/log/index.html +++ b/web/views/@default/servers/server/log/index.html @@ -2,12 +2,28 @@ {$template "/left_menu"}
+ +
+ + +
+
+ +
+
+ +
+
+ +
+
+

今天暂时还没有访问日志。

- +
\ No newline at end of file diff --git a/web/views/@default/servers/server/log/today.html b/web/views/@default/servers/server/log/today.html index afaa6f23..c9e6d300 100644 --- a/web/views/@default/servers/server/log/today.html +++ b/web/views/@default/servers/server/log/today.html @@ -3,8 +3,22 @@ {$template "/left_menu"}
- 所有日志 - 错误日志 + 所有日志 + 错误日志 + +
+
+ +
+
+ +
+
+ +
+
+
+

今天暂时还没有访问日志。

@@ -12,15 +26,15 @@ - +
- 上一页 + 上一页 上一页   |   - 下一页 + 下一页 下一页
\ No newline at end of file