2018-06-20 05:26:44 +00:00
|
|
|
# commit d02286d
|
|
|
|
# BUG/MINOR: log: pin the front connection when front ip/ports are logged
|
|
|
|
#
|
|
|
|
# Mathias Weiersmueller reported an interesting issue with logs which Lukas
|
|
|
|
# diagnosed as dating back from commit 9b061e332 (1.5-dev9). When front
|
|
|
|
# connection information (ip, port) are logged in TCP mode and the log is
|
|
|
|
# emitted at the end of the connection (eg: because %B or any log tag
|
|
|
|
# requiring LW_BYTES is set), the log is emitted after the connection is
|
|
|
|
# closed, so the address and ports cannot be retrieved anymore.
|
|
|
|
#
|
2018-11-14 04:15:49 +00:00
|
|
|
# It could be argued that we'd make a special case of these to immediately
|
2018-06-20 05:26:44 +00:00
|
|
|
# retrieve the source and destination addresses from the connection, but it
|
|
|
|
# seems cleaner to simply pin the front connection, marking it "tracked" by
|
|
|
|
# adding the LW_XPRT flag to mention that we'll need some of these elements
|
|
|
|
# at the last moment. Only LW_FRTIP and LW_CLIP are affected. Note that after
|
|
|
|
# this change, LW_FRTIP could simply be removed as it's not used anywhere.
|
|
|
|
#
|
|
|
|
# Note that the problem doesn't happen when using %[src] or %[dst] since
|
|
|
|
# all sample expressions set LW_XPRT.
|
|
|
|
|
2019-03-29 14:07:24 +00:00
|
|
|
#REGTEST_TYPE=bug
|
|
|
|
|
2018-06-20 05:26:44 +00:00
|
|
|
varnishtest "Wrong ip/port logging"
|
|
|
|
feature ignore_unknown_macro
|
|
|
|
|
|
|
|
server s1 {
|
|
|
|
rxreq
|
2019-04-01 13:33:19 +00:00
|
|
|
delay 0.02
|
2018-06-20 05:26:44 +00:00
|
|
|
} -start
|
|
|
|
|
|
|
|
syslog Slg_1 -level notice {
|
|
|
|
recv info
|
2018-10-28 18:19:48 +00:00
|
|
|
expect ~ \"dip\":\"${h1_fe_1_addr}\",\"dport\":\"${h1_fe_1_port}.*\"ts\":\"[cC]D\",\"
|
2018-06-20 05:26:44 +00:00
|
|
|
} -start
|
|
|
|
|
|
|
|
haproxy h1 -conf {
|
|
|
|
global
|
|
|
|
log ${Slg_1_addr}:${Slg_1_port} local0
|
|
|
|
|
|
|
|
defaults
|
|
|
|
log global
|
2021-11-18 16:46:22 +00:00
|
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
2018-10-28 18:19:48 +00:00
|
|
|
timeout client 1
|
2021-11-18 16:46:22 +00:00
|
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
2018-06-20 05:26:44 +00:00
|
|
|
|
|
|
|
frontend fe1
|
|
|
|
bind "fd@${fe_1}"
|
|
|
|
mode tcp
|
|
|
|
log-format {\"dip\":\"%fi\",\"dport\":\"%fp\",\"c_ip\":\"%ci\",\"c_port\":\"%cp\",\"fe_name\":\"%ft\",\"be_name\":\"%b\",\"s_name\":\"%s\",\"ts\":\"%ts\",\"bytes_read\":\"%B\"}
|
|
|
|
default_backend be_app
|
|
|
|
|
|
|
|
backend be_app
|
2018-12-08 20:36:55 +00:00
|
|
|
server app1 ${s1_addr}:${s1_port}
|
2018-06-20 05:26:44 +00:00
|
|
|
} -start
|
|
|
|
|
|
|
|
client c1 -connect ${h1_fe_1_sock} {
|
|
|
|
txreq -url "/"
|
2019-05-07 10:00:36 +00:00
|
|
|
expect_close
|
2018-06-20 05:26:44 +00:00
|
|
|
} -run
|
|
|
|
|
|
|
|
syslog Slg_1 -wait
|
|
|
|
|