diff --git a/internal/web/actions/default/servers/logs/index.go b/internal/web/actions/default/servers/logs/index.go
index 2bec0cb3..41e646de 100644
--- a/internal/web/actions/default/servers/logs/index.go
+++ b/internal/web/actions/default/servers/logs/index.go
@@ -3,12 +3,14 @@
package logs
import (
+ "fmt"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/lists"
timeutil "github.com/iwind/TeaGo/utils/time"
"regexp"
"strings"
+ "time"
)
type IndexAction struct {
@@ -46,6 +48,8 @@ func (this *IndexAction) RunGet(params struct {
this.Data["hasError"] = params.HasError
this.Data["hasWAF"] = params.HasWAF
this.Data["pageSize"] = params.PageSize
+ this.Data["isSlowQuery"] = false
+ this.Data["slowQueryCost"] = ""
day := params.Day
ipList := []string{}
@@ -59,6 +63,7 @@ func (this *IndexAction) RunGet(params struct {
this.Data["hasError"] = params.HasError
+ var before = time.Now()
resp, err := this.RPC().HTTPAccessLogRPC().ListHTTPAccessLogs(this.AdminContext(), &pb.ListHTTPAccessLogsRequest{
RequestId: params.RequestId,
ServerId: params.ServerId,
@@ -75,6 +80,12 @@ func (this *IndexAction) RunGet(params struct {
return
}
+ var cost = time.Since(before).Seconds()
+ if cost > 5 {
+ this.Data["slowQueryCost"] = fmt.Sprintf("%.2f", cost)
+ this.Data["isSlowQuery"] = true
+ }
+
if len(resp.HttpAccessLogs) == 0 {
this.Data["accessLogs"] = []interface{}{}
} else {
diff --git a/web/views/@default/servers/logs/index.html b/web/views/@default/servers/logs/index.html
index 5c462a63..f334f4c9 100644
--- a/web/views/@default/servers/logs/index.html
+++ b/web/views/@default/servers/logs/index.html
@@ -19,6 +19,8 @@
+
暂时还没有访问日志。