【问题标题】:Meaning of HA-Proxy logHA-Proxy 日志的含义
【发布时间】:2021-12-18 10:42:02
【问题描述】:
在 HA-Proxy 中获取以下日志,并且它不会影响我的 spring-boot 应用程序的控制器方法。而且它也没有提到http状态码。但其他请求有http状态码。
Nov 4 11:56:31 localhost haproxy[24972]: 112.134.131.29:17817 [04/Nov/2021:11:56:31.862] myservice k8-sit-masters/k8-master-2 0/0/0/-1/0 -1 0 - - SD-- 2/2/0/0/0 0/0 "POST /path/to/my/url HTTP/1.1"
知道这个日志的含义是什么。
【问题讨论】:
标签:
haproxy
haproxy-ingress
【解决方案1】:
Nov 4 11:56:31 => Log Time Stamp
localhost => Hostname or IP address of HAProxy host
haproxy[24972] => Process ID for the HAProxy process
112.134.131.29:17817 => Source IP:Source Port
[04/Nov/2021:11:56:31.862] => Request Accepted timestamp
myservice => Front-end name
k8-sit-masters/k8-master => Target request was routed to
0/0/0/-1/0 => Time waiting for full request from client (ms) / Time waiting in queues (ms) / Time to establish connection to destination server (ms) / Time for destination server to send response (ms) / Total time request active in HAProxy (ms)
-1 => http status
0 => bytes read
- - => Pptional values (captured request cookie, captured response cookie)
SD-- => Termination state, cookie status
2/2/0/0/0 => Active connections / Front-end connections / Back-end connections / Server connections / Retries
0/0 => Server queue size / Back-end queue size
"POST /path/to/my/url HTTP/1.1" => Request method, API URL, http version
参考:HAProxy Log definition
正如我们在日志中看到的http状态码是-1。 -1 表示状态码不可用。原因在于终止标志字段。在您的情况下,termination flag 值是 SD。这里
S => the TCP session was unexpectedly aborted by the server, or the
server explicitly refused it.
D => the session was killed by haproxy because the server was detected
as down and was configured to kill all connections when going down.