diff --git a/plugins/openresty/conf/nginx.conf b/plugins/openresty/conf/nginx.conf index a08233d44..674cbd862 100644 --- a/plugins/openresty/conf/nginx.conf +++ b/plugins/openresty/conf/nginx.conf @@ -28,6 +28,7 @@ http server_names_hash_bucket_size 512; client_header_buffer_size 32k; large_client_header_buffers 4 32k; + client_body_buffer_size 50m; client_max_body_size 50m; sendfile on; diff --git a/plugins/webstats/conf/webstats.conf b/plugins/webstats/conf/webstats.conf index 6e4c6e0d9..5b3277ea2 100644 --- a/plugins/webstats/conf/webstats.conf +++ b/plugins/webstats/conf/webstats.conf @@ -1,2 +1,3 @@ lua_shared_dict mw_total 100m; +lua_need_request_body off; include {$SERVER_APP}/lua/webstats_log.lua; \ No newline at end of file diff --git a/plugins/webstats/index.py b/plugins/webstats/index.py index 784a555c6..9ec2279ea 100755 --- a/plugins/webstats/index.py +++ b/plugins/webstats/index.py @@ -5,6 +5,7 @@ import io import os import time import json +import re sys.path.append(os.getcwd() + "/class/core") import mw @@ -292,6 +293,22 @@ def getGlobalConf(): return mw.returnJson(True, 'ok', content) +def openLuaNeedRequestBody(): + conf = luaConf() + content = mw.readFile(conf) + content = re.sub("lua_need_request_body (.*);", + 'lua_need_request_body on;', content) + mw.writeFile(conf, content) + + +def closeLuaNeedRequestBody(): + conf = luaConf() + content = mw.readFile(conf) + content = re.sub("lua_need_request_body (.*);", + 'lua_need_request_body off;', content) + mw.writeFile(conf, content) + + def setGlobalConf(): args = getArgs() @@ -299,14 +316,23 @@ def setGlobalConf(): content = mw.readFile(conf) content = json.loads(content) + open_force_get_request_body = False for v in ['record_post_args', 'record_get_403_args']: data = checkArgs(args, [v]) if data[0]: rval = False if args[v] == "true": rval = True + open_force_get_request_body = True + content['global'][v] = rval + # 开启强制获取日志配置 + if open_force_get_request_body: + openLuaNeedRequestBody() + else: + closeLuaNeedRequestBody() + for v in ['ip_top_num', 'uri_top_num', 'save_day']: data = checkArgs(args, [v]) if data[0]: