访问日志可以使用分表查询

This commit is contained in:
GoEdgeLab
2022-04-17 16:18:43 +08:00
parent 53b1b2c572
commit 9d2eb11e1f
12 changed files with 212 additions and 17 deletions

View File

@@ -20,6 +20,8 @@ func (this *IndexAction) Init() {
func (this *IndexAction) RunGet(params struct {
Ip string
Partition int32 `default:"-1"`
}) {
this.Data["ip"] = params.Ip
@@ -103,9 +105,10 @@ func (this *IndexAction) RunGet(params struct {
// 访问日志
accessLogsResp, err := this.RPC().HTTPAccessLogRPC().ListHTTPAccessLogs(this.AdminContext(), &pb.ListHTTPAccessLogsRequest{
Day: timeutil.Format("Ymd"),
Ip: params.Ip,
Size: 20,
Partition: params.Partition,
Day: timeutil.Format("Ymd"),
Ip: params.Ip,
Size: 20,
})
if err != nil {
this.ErrorPage(err)
@@ -115,9 +118,10 @@ func (this *IndexAction) RunGet(params struct {
if len(accessLogs) == 0 {
// 查询昨天
accessLogsResp, err = this.RPC().HTTPAccessLogRPC().ListHTTPAccessLogs(this.AdminContext(), &pb.ListHTTPAccessLogsRequest{
Day: timeutil.Format("Ymd", time.Now().AddDate(0, 0, -1)),
Ip: params.Ip,
Size: 20,
Partition: params.Partition,
Day: timeutil.Format("Ymd", time.Now().AddDate(0, 0, -1)),
Ip: params.Ip,
Size: 20,
})
if err != nil {
this.ErrorPage(err)