服务访问日志增加关键词搜索

This commit is contained in:
刘祥超
2021-06-04 10:15:31 +08:00
parent 0f5f175f08
commit 98f8fb3bec
7 changed files with 58 additions and 13 deletions

View File

@@ -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,
})

View File

@@ -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 {

View File

@@ -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 {