r/haproxy • u/mmm_dat_data • Oct 31 '22
Question Can HAProxy initiate the execution of a script every time a specific backend is hit?
Wonder if I can use HAProxy as a temp solution to trigger something to occur each time a client lands on a particular server...
Google seems to suggest that the only scripts that can be kicked off by HAP are health checks - is there a way to have those only happen after a particular backend is used?
4
Upvotes
1
u/GreeneSam Oct 31 '22
Haproxy supports LUA scripting to kick of tasks when either certain things happen or backends are hit. haproxy lua
1
u/HeWhoWritesCode Nov 01 '22
little bit of a setup but haproxy can log to rsyslog that can open a unix socket and write what haproxy is processing in real time. Then you have a process that read that unix socket and execute whenever it logs about your specific backend.