I just find out that even in nginx access_log, this is also the same situation. Maybe it's designed just as is.
not sure if this related to https://github.com/openresty/lua-nginx-module/issues/246
在 2016年11月25日星期五 UTC+8下午4:22:34,war baby写道:
test case :
log_subrequest on; #must be on to log subrequests
location /bulk {
content_by_lua_block {
local resp = { ngx.location.capture_multi {
{ "/sub?say=hello1" },
{ "/sub?say=hello2" }
} }
ngx.say("sub:", #resp)
for _, v in ipairs(resp) do
ngx.say(v.body)
end
}
}
location /sub {
content_by_lua_block {
ngx.sleep(0.3)
ngx.say(ngx.req.get_uri_args().say)
}
}
log_by_lua_block {
ngx.log(ngx.CRIT, ngx.var.uri, " ", ngx.is_subrequest, " ", ngx.var.bytes_sent, " ", ngx.var.request_time)
}
the log is:
[crit] [lua] log_by_lua: /sub true 0 0.301, client: 127.0.0.1
[crit] [lua] log_by_lua: /sub true 0 0.301, client: 127.0.0.1
[crit] [lua] log_by_lua: /bulk false 225 0.301 while logging request, client: 127.0.0.1,