HAProxy community

Where do LUA prints go in HAProxy?


I want to print some fields in LUA script and then add some logic.

How and where do I get the LUA script prints.
Please suggest correct steps for LUA prints.
I have /var/log/haproxy.log enabled but no LUA script print goes to haproxy.log neither any LUA print over console.

Access HAProxy to connect with one of servers
curl -vk --key client1.key --cert ./client1.crt

HAProxy IP =
HAProxy config
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy

lua-load /usr/sbin/lua-choose-backend.lua
frontend http-in
mode http
bind *:443 ssl crt /etc/haproxy/server.pem ca-file /etc/haproxy/ca.crt verify required
use_backend %[lua.choose_backend]
default_backend app
reqadd X-Forwarded-Proto:\ https if { ssl_fc }
option forwardfor

backend bk1-gr1
balance roundrobin
server app1 check

backend bk2-gr1
balance roundrobin
server app2 check

backend bk3-gr2
balance roundrobin
server app3 check

backend bk4-gr2
balance roundrobin
server app4 check

backend default
balance roundrobin
server app5 check

clien1 => CN=client1:group-gr1
clien2 => CN=client2:group-gr1

function choose_backend(txn)


        -- some logic here to select backend              

        return "app"

return "default"


core.register_fetches(“choose_backend”, choose_backend)


hi. when haproxy is launched in daemon mode, none is displayed on stdout. if the option quiet is qet, none is displayed. try the “debug” option.

using the standard output for displaying log is a bad idea because haproxy is limited by the speed of the stdout.

some log functions are available for the lua. try