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
#---------------------------------------------------------------------
global
daemon
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
#---------------------------------------------------------------------
defaults
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
bind 192.16.1.103:80
use_backend http_be
backend http_be
mode http
option http-keep-alive
option forwardfor
option redispatch
balance roundrobin
server 192.16.1.6 192.16.1.6:80
server 192.16.1.5 192.16.1.5:
80
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]: 253.255.0.35:44932 [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 192.16.1.103:80 0.0.0.0:* LISTEN 12/haproxy
tcp 0 0 192.16.1.103:22 0.0.0.0:* LISTEN 12/haproxy
Or outside on pod node:
netstat -ntpl | grep :1024
tcp 0 0 127.0.0.1:10248 0.0.0.0:* LISTEN 21586/kubelet
tcp 0 0 127.0.0.1:10249 0.0.0.0:* LISTEN – Br