我在kubernetes集群中运行nginx-ingress控制器,其中一个请求的日志语句如下所示:
upstream_response_length: 0, 840
upstream_response_time: 60.000, 0.760
upstream_status: 504, 200我不太明白这是什么意思?Nginx的响应超时等于60秒,然后尝试再次请求(成功)并记录两次请求?
P.S.日志格式配置:
log-format-upstream: >-
{
...
"upstream_status": "$upstream_status",
"upstream_response_length": "$upstream_response_length",
"upstream_response_time": "$upstream_response_time",
...
}发布于 2019-09-26 17:22:10
根据ingress-nginx的split_upstream_var方法,它splits了nginx health checks的结果。
因为nginx可以有several upstreams,所以您的日志可以这样解释:
(第一个上游已死(504))
upstream_response_length: 0 // responce from dead upstream has zero length
upstream_response_time: 60.000 // nginx dropped connection after 60sec
upstream_status: 504 // responce code, upstream doesn't answerupstream_response_length: 840 // healthy upstream returned 840b
upstream_response_time: 0.760 // healthy upstream responced in 0.760
upstream_status: 200 // responce code, upstream is ok附注: JFYI,这是一个很酷的HTTP头状态图

https://stackoverflow.com/questions/58111709
复制相似问题