配置req_status_show_field 后,reload报 段错误 (core dumped)
[alibaba/tengine]使用req_status_show_field就无法reload
回答
有更完整的 复现方法 或者 报错信息吗(如 nginx error.log 或者gdb coredump stacktrace)
添加了下面的配置,nginx -t就报”段错误 (core dumped)“,没有错误日志输出,注释掉req_status_show_field 就正常。
location /us {
req_status_show;
req_status_show_field kv,bytes_in,bytes_out,conn_total,req_total,http_2xx,http_3xx,http_4xx,http_5xx,http_other_status,rt,ups_req,ups_rt,ups_tries,http_200,http_206,http_302,http_304,http_403,http_404,http_416,http_499,http_500,http_502,http_503,http_504,http_508,http_other_detail_status,http_ups_4xx,http_ups_5xx;
}
[root@WWWUATDB conf.d]# nginx -t
段错误 (core dumped)
我已经尝试过很多组合都不行,版本也尝试过master2.2.0,2.1.2.f是一样的问题:
req_status_show_field kv,bytes_in;
req_status_show_field bytes_in;
我现在是使用echo-nginx-module,然后--without-http_footer_filter_module,采用下面的方法格式化显示的。
location /us {
echo_before_body "<div id='data' style='display:none'>";
echo_after_body "</div><table id='result' style='background-color:white' cellspacing='0' cellpadding='3' border='1'></table><script>var d=document.getElementById('data').innerHTML.split('\\n'),dt='host,address,bytes_in,bytes_out,conn_total,req_total,http_2xx,http_3xx,http_4xx,http_5xx,http_other_status,req_time,ups_req,ups_time,ups_tries,http_200,http_206,http_302,http_304,http_403,http_404,http_416,http_499,http_500,http_502,http_503,http_504,http_508,http_other_detail_status,http_ups_4xx,http_ups_5xx'.split(','),ti=[0,1,2,3,4,5,11,12,13,14,29,30,6,15,16,7,17,18,8,19,20,21,22,9,23,24,25,26,27,10,28],html='';d.pop();d.shift();html+='<tr bgcolor=\\'#C0C0C0\\'>';for(var j=0;j<ti.length;j++)if(!!dt[ti[j]])html+='<th title=\\\''+ti[j]+'\\\'>'+dt[ti[j]]+'</th>';html+='</tr>';for(var i=d.length-1;i>=0;i--){var ds=d[i].split(',');html+='<tr>';for(var j=0;j<ti.length;j++)if(!!dt[ti[j]])html+='<td>'+ds[ti[j]]+'</td>';html+='</tr>'}document.getElementById('result').innerHTML=html</script>";
req_status_show;
}
hi @WPG 我们已经修复该bug: https://github.com/alibaba/tengine/pull/816 可以使用最新master分支尝试。另外你的配置要这么写才行:
req_status_show_field bytes_in bytes_out conn_total req_total http_2xx http_3xx http_4xx http_5xx http_other_status rt ups_req ups_rt ups_tries http_200 http_206 http_302 http_304 http_403 http_404 http_416 http_499 http_500 http_502 http_503 http_504 http_508 http_other_detail_status http_ups_4xx http_ups_5xx;
req_status_show_field指令各个参数使用空格间隔,而不是用逗号。且kv
字段不是其合理参数,该指令默认会输出kv
字段。
谢谢,可以reload了