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: `