增加WAF策略日志设置

This commit is contained in:
GoEdgeLab
2022-04-21 20:00:56 +08:00
parent 8059ff4e65
commit fe520744b0
3 changed files with 49 additions and 3 deletions

View File

@@ -354,6 +354,7 @@ func (this *HTTPAccessLogDAO) listAccessLogs(tx *dbs.Tx,
// 准备查询
var tableQueries = []*accessLogTableQuery{}
var maxTableName = ""
for _, daoWrapper := range daoList {
var instance = daoWrapper.DAO.Instance
def, err := SharedHTTPAccessLogManager.FindPartitionTable(instance, day, partition)
@@ -364,6 +365,10 @@ func (this *HTTPAccessLogDAO) listAccessLogs(tx *dbs.Tx,
continue
}
if len(maxTableName) == 0 || def.Name > maxTableName {
maxTableName = def.Name
}
tableQueries = append(tableQueries, &accessLogTableQuery{
daoWrapper: daoWrapper,
name: def.Name,
@@ -372,6 +377,18 @@ func (this *HTTPAccessLogDAO) listAccessLogs(tx *dbs.Tx,
})
}
// 检查各个分表是否一致
if partition < 0 {
var newTableQueries = []*accessLogTableQuery{}
for _, tableQuery := range tableQueries {
if tableQuery.name != maxTableName {
continue
}
newTableQueries = append(newTableQueries, tableQuery)
}
tableQueries = newTableQueries
}
if len(tableQueries) == 0 {
return nil, "", nil
}
@@ -606,7 +623,7 @@ func (this *HTTPAccessLogDAO) listAccessLogs(tx *dbs.Tx,
locker.Lock()
for _, one := range ones {
accessLog := one.(*HTTPAccessLog)
var accessLog = one.(*HTTPAccessLog)
result = append(result, accessLog)
}
locker.Unlock()