I am not getting any logs when I set the log level as err. When I give 503 req manually also, the acl failure_request not works it seems as I don’t see any logs in /var/logs/haprxy/error.log But if change from err to info i see some logs. Why it is not working? I am newbie to this community, Someone please help me
Global configuration
global
log 127.0.0.1:514 local0
log 127.0.0.1:514 local0 err
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
tune.ssl.default-dh-param 2048
ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:EECDH+aRSA+AES+SHA256:EECDH+aRSA+AES+SHA384:AES128-GCM-SHA256:AES256-GCM-SHA384:RSA+AES128+SHA256:RSA+AES256+SHA256:EECDH+aRSA+AES128+SHA:EECDH+aRSA+AES256+SHA:RSA+AES+SHA:!aNULL:!eNULL:!LOW:!MD5:!EXP:!PSK:!SRP:!DSS:!3DES
Default SSL material locations
defaults
log global
mode http
option httplog
option dontlognull
log-format “%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r”
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
Frontend and backend definition
frontend http_front
log global
bind *:80
acl failed_request status 400:409 429 500:503
http-response set-log-level err if failed_request
use_backend servers if { hdr(host) -i localhost }
default_backend servers
backend servers
# balance source
# # option httpchk GET /healthcheck
# server server1 172.19.0.2:80
# server server2 172.19.0.3:80
# server server3 172.19.0.4:80
# server server4 172.19.0.5:80
server nodeserver 17.0.0.1:8082
listen stats
bind :8080
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth admin:sriram78
rsyslog conf (/etc/rsyslog.d/49-haproxy.conf)
$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514
Creating separate log files based on the severity
local0.* /var/log/haproxy/access.log
local0.err /var/log/haproxy/error.log
Request I gave:
curl http://localhost:80/
503 Service Unavailable
No server is available to handle this request.Still i dont get logs in /var/logs/haproxy/error.log