I’m struggling to get access and health check logs from haproxy when I run it inside a container, so I’ve followed the instructions in the docs (Setting up logs using Docker | HAProxy Enterprise 2.2r1) and my config looks like:

# Global settings
    log stdout format raw local0
    maxconn     4000
    nbproc 1
    nbthread 12
    # turn on stats unix socket
    # stats socket /var/lib/haproxy/stats

# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
      timeout connect         10s
      timeout check           10s
      timeout client          60s
     timeout server          60s
     timeout queue           60s
     timeout http-keep-alive 10s
     maxconn                 3000
    log global
    retries                 3
frontend http_in
    mode    http
    timeout http-request    10s
   option http-keep-alive
   option forwardfor
   use_backend http_be

backend http_be
   mode    http
   option http-keep-alive
   option forwardfor
   option redispatch
   balance roundrobin


But the only logs I sees in the kubernetes logs are then haproxy starts:

kubectl logs vcn1-lb1-78c4c86676-w4q2p
Proxy http_in started.
Proxy http_be started.

I’ve tried:

log stdout format raw local0 debug
log stderr format raw local0 debug
log stderr format raw local0

But nothing gives me access or health check log data? The type of log I want, is the type you see when not running haproxy in a container:

The type of log I'm looking for are the standard logs you get when you run it outside a container:

Jan 23 10:29:00 ca-rain03 haproxy[5789]: Health check for server admin_be/ca-rain03 succeeded, reason: Layer7 check passed, code: 200, check duration: 1ms, status: 3/3 UP. 
Jan 23 10:30:52 ca-rain03 haproxy[5789]: [23/Jan/2021:10:30:52.270] http_in admin_be/ca-rain01 0/0/0/1/1 200 219 - - ---- 1/1/0/0/0 0/0 "GET / HTTP/1.1"

As for the suggestion to listen on port 1024, nothing is listening on that port either in the container or on the pod node:

netstat -ntpl 
   Local Address Foreign Address State PID/Program name 
   tcp 0 0* LISTEN 12/haproxy 
   tcp 0 0* LISTEN 12/haproxy 

Or outside on pod node:

netstat -ntpl | grep :1024 
tcp 0 0* LISTEN 21586/kubelet 
tcp 0 0* LISTEN – Br
  • 1
    Talking from the perspective of community edition HAProxy Ingress Controller you can get the stats like healthz on the container port 1024 (web browser should be better to display all of the tables rather than curl). Please check what this port is exposing and tell if this is what you are looking for.
    – Dawid Kruk
    Jan 26, 2021 at 14:05
  • Please don't put code snippets in the comments, as they're very hard to read; edit your question and include them there. Plus, you can fix your "I've tried" stanza to be formatted correctly, too; win-win :-)
    – mdaniel
    Jan 27, 2021 at 4:18
  • done pas per reques
    – Bren
    Jan 27, 2021 at 11:19


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.