当集群设置不允许记录访问日志时,在网站的访问日志查看页面提醒

This commit is contained in:
GoEdgeLab
2023-07-05 15:55:47 +08:00
parent 1ec1971938
commit f0f5fcff54
7 changed files with 87 additions and 7 deletions

View File

@@ -1,7 +1,6 @@
package log
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/lists"
@@ -10,7 +9,7 @@ import (
)
type IndexAction struct {
actionutils.ParentAction
BaseAction
}
func (this *IndexAction) Init() {
@@ -36,6 +35,11 @@ func (this *IndexAction) RunGet(params struct {
this.Data["clusterId"] = params.ClusterId
this.Data["nodeId"] = params.NodeId
// 检查集群全局设置
if !this.initClusterAccessLogConfig(params.ServerId) {
return
}
// 记录最近使用
_, err := this.RPC().LatestItemRPC().IncreaseLatestItem(this.AdminContext(), &pb.IncreaseLatestItemRequest{
ItemType: "server",
@@ -83,7 +87,7 @@ func (this *IndexAction) RunPost(params struct {
var ipList = []string{}
var wafMaps = []maps.Map{}
var accessLogs = accessLogsResp.HttpAccessLogs
if len(accessLogs) == 0 {
accessLogs = []*pb.HTTPAccessLog{}