Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
Created December 4, 2023 18:52
Show Gist options
  • Save haproxytechblog/4f8c9be81c61062ee0bf845c6225deba to your computer and use it in GitHub Desktop.
Save haproxytechblog/4f8c9be81c61062ee0bf845c6225deba to your computer and use it in GitHub Desktop.
Announcing HAProxy 2.9
global
log backend@mylog-rrb local0
backend mylog-rrb
mode log
balance roundrobin
server s1 udp@10.0.0.1:514
server s2 udp@10.0.0.2:514
log-forward graylog
# Listen on Graylog ports
bind :12201
dgram-bind :12201
log backend@mylog-rrb local0
backend mylog-rrb
mode log
balance roundrobin
server log1 udp@10.0.0.1:514
server log2 udp@10.0.0.2:514
# get a integer value from the request body
# "{"integer":4}" => 5
http-request set-var(txn.pay_int) req.body,json_query('$.integer','int'),add(1)
http-response set-var-fmt(txn.queue_time) %Tw
http-response set-var-fmt(txn.connect_time) %Tc
http-response set-var-fmt(txn.response_time) %Tr
http-response set-var(txn.total_response_time) var(txn.queue_time),add(txn.connect_time),add(txn.response_time)
http-after-response set-log-level err if { txn.timer.user ge 5000 }
acl(!is_malware,goodguys,auth_ok)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment