This commit is contained in:
Mr Chen
2019-05-06 14:04:38 +08:00
parent bdfcf9179d
commit e6e0f7dea7
2 changed files with 15 additions and 4 deletions
+3 -3
View File
@@ -655,9 +655,9 @@ def setCcConf():
tmp = cobj['cc']
tmp['cycle'] = args['cycle']
tmp['limit'] = args['limit']
tmp['endtime'] = args['endtime']
tmp['cycle'] = int(args['cycle'])
tmp['limit'] = int(args['limit'])
tmp['endtime'] = int(args['endtime'])
tmp['is_open_global'] = args['is_open_global']
tmp['increase'] = args['increase']
cobj['cc'] = tmp
+12 -1
View File
@@ -126,6 +126,17 @@ end
function _M.write_file(self, filename, body)
fp = io.open(filename,'ab')
if fp == nil then
return nil
end
fp:write(body)
fp:flush()
fp:close()
return true
end
function _M.write_file_clear(self, filename, body)
fp = io.open(filename,'w')
if fp == nil then
return nil
@@ -245,7 +256,7 @@ function _M.inc_log(self, name, rule)
if not total_log then return false end
ngx.shared.limit:set(total_path,total_log)
if not ngx.shared.limit:get('mw_waf_timeout') then
self:write_file(total_path,total_log)
self:write_file_clear(total_path,total_log)
ngx.shared.limit:set('mw_waf_timeout',1,5)
end
end