Search code examples
haproxyhaproxy-ingress

Meaning of HA-Proxy log


Getting following log in HA-Proxy, and its not hitting to my spring-boot application's controller method. And also it is not mentioning the http status code as well. but other requests has http status code.

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"

Any idea what the meaning of this log.


Solution

  • 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
    

    Reference: HAProxy Log definition

    As we can see in the log http status code is -1. -1 indicates that the status code is not available. The reason is in the termination flags field. In your case termination flag value is SD. Here

    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.