From 5f940703b3572f5777be69fa18863578d985e204 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 6 Apr 2020 10:40:02 +0200 Subject: [PATCH] MINOR: log: Don't depends on a stream to process samples in log-format string When a log-format string is evaluated, there is no reason to process sample fetches only when a stream is defined. Several sample fetches are available outside the stream scope. All others should handle calls without stream. This patch is mandatory to support log-format string in tcp-check rules. --- src/log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/log.c b/src/log.c index 5204de2b2d..4f3c7c710a 100644 --- a/src/log.c +++ b/src/log.c @@ -2065,9 +2065,9 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t case LOG_FMT_EXPR: // sample expression, may be request or response key = NULL; - if (tmp->options & LOG_OPT_REQ_CAP && s) + if (tmp->options & LOG_OPT_REQ_CAP) key = sample_fetch_as_type(be, sess, s, SMP_OPT_DIR_REQ|SMP_OPT_FINAL, tmp->expr, SMP_T_STR); - if (!key && (tmp->options & LOG_OPT_RES_CAP) && s) + if (!key && (tmp->options & LOG_OPT_RES_CAP)) key = sample_fetch_as_type(be, sess, s, SMP_OPT_DIR_RES|SMP_OPT_FINAL, tmp->expr, SMP_T_STR); if (tmp->options & LOG_OPT_HTTP) ret = lf_encode_chunk(tmplog, dst + maxsize, -- 2.39.5