Skip to content

Commit 7b421d7

Browse files
committed
fix(btwaf_rule_hit) 修复日志不满20000就清理日志
从5M大小的文件就清理修改为10M才清理 保留2000条改为20000条
1 parent e625921 commit 7b421d7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

providers/cron.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ func btwafRuleHitClear() {
6060
if err != nil {
6161
return
6262
}
63-
if fileInfo.Size() > 5*1024*1024 {
64-
data, err := public.Tail(path, 1000)
63+
if fileInfo.Size() > 10*1024*1024 {
64+
data, err := public.Tail(path, 10000)
6565
if err != nil {
6666
public.WriteFile(path, "")
6767
}
6868
public.WriteFile(path, data)
69-
logging.Error("命中记录文件大于5M,内容保留最后1000条")
69+
logging.Error("命中记录文件大于10M,内容保留最后10000条")
7070
}
7171
}
7272
}
@@ -245,12 +245,10 @@ func (cr *cronProvider) CheckHitLog() {
245245
return
246246
}
247247

248-
data, err := public.Tail(path, 2000)
248+
data, err := public.Tail(path, 20001)
249249
if err != nil {
250-
251250
return
252251
}
253-
254252
public.WriteFile(path, data)
255253

256254
}

0 commit comments

Comments
 (0)