0

在 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"

知道这个日志的含义是什么。

4

1 回答 1

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 日志定义

正如我们在日志中看到的http状态码是-1。-1 表示状态码不可用。原因在于终止标志字段。在您的情况下,终止标志值为 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.
于 2021-11-04T07:05:58.497 回答