Add lfp mapping and include in log line as an example

This commit is contained in:
Thomas Lynch
2025-03-31 23:47:02 +11:00
parent 455612e998
commit 9107985f44
2 changed files with 4 additions and 3 deletions

2
.gitignore vendored
View File

@ -3,5 +3,5 @@ haproxy/*.pem
haproxy/*.crt
haproxy/dataplaneapi
src/lua/scripts/tfp.lua
#ignore self-signed cert
haproxy/map/lfp.map
certs/*

View File

@ -62,11 +62,12 @@ frontend http-in
# bind 127.0.0.1:80 accept-proxy
option forwardfor
# tfp lua dev test
# tfp lua dev test (with lookup mapping)
http-request lua.set_tfp
http-request set-var(txn.fp_custom_lookup) var(txn.fp_custom),map(/etc/haproxy/map/lfp.map)
# custom log format
log-format "{\"cc\":%{+Q}[capture.req.hdr(1)],\"tp\":%{+Q}[var(txn.fp_custom)],\"cip\":\"%ci\",\"cp\":\"%cp\",\"hh\":%{+Q}[capture.req.hdr(0)],\"backend\":\"%b\",\"server\":\"%s\",\"timers\":\"%TR/%Tw/%Tc/%Tr/%Ta\",\"status\":\"%ST\",\"bytes\":\"%B\",\"bs\":\"%U\",\"conns\":\"%ac/%fc/%bc/%sc/%rc\",\"q\":\"%sq/%bq\",\"req\":%{+Q,+E}r,\"GeoIP_Source\":\"GeoIP_Source=%ci\"}"
log-format "{\"cc\":%{+Q}[capture.req.hdr(1)],\"tp\":%{+Q}[var(txn.fp_custom)],\"tpl\":%{+Q}[var(txn.fp_custom_lookup)],\"cip\":\"%ci\",\"cp\":\"%cp\",\"hh\":%{+Q}[capture.req.hdr(0)],\"backend\":\"%b\",\"server\":\"%s\",\"timers\":\"%TR/%Tw/%Tc/%Tr/%Ta\",\"status\":\"%ST\",\"bytes\":\"%B\",\"bs\":\"%U\",\"conns\":\"%ac/%fc/%bc/%sc/%rc\",\"q\":\"%sq/%bq\",\"req\":%{+Q,+E}r,\"GeoIP_Source\":\"GeoIP_Source=%ci\"}"
# optional geoip handling (maps required) and alt-svc header addition
http-request set-var(req.xcc) src,map_ip(/etc/haproxy/map/geoip.map)