set the log in nginx.conf1234567891011121314location /docs { keepalive_timeout 0; default_type 'text/html'; set $res ""; set_by_lua_file $res /opt/openresty/set_by.lua; rewrite_by_lua_file /opt/openresty/rewrite.lua; access_by_lua_file /opt/openresty/access.lua; content_by_lua_file /opt/openresty/content.lua; header_filter_by_lua_file /opt/openresty/header_filter.lua; body_filter_by_lua_file /opt/openresty/body_filter.lua; log_by_lua_file /opt/openresty/base/log.lua; proxy_pass http://default_doc_upstream;} log_by_lua_file12345678910111213141516171819local cjson = require("cjson");local upstream_addr = nil;if nil ~= ngx.var.upstream_addr then upstream_addr = ngx.var.upstream_addr;else upstream_addr = nil;endngx.log(ngx.INFO, "upstream_addr="..upstream_addr);--if nil ~= ngx.var.upstream_response_time and 'number' == type(ngx.var.upstream_response_time) then local resp_time_so_far = ngx.now() - tonumber(ngx.var.upstream_response_time); -- 1s if tonumber(ngx.var.upstream_response_time) >= 1 then ngx.log(ngx.WARN, "[SLOW] request_time="..ngx.var.request_time.." upstream_response_time="..ngx.var.upstream_response_time..", upstream_addr="..upstream_addr); endend