diff --git a/include/haproxy/log-t.h b/include/haproxy/log-t.h index dae5067e5..f56396874 100644 --- a/include/haproxy/log-t.h +++ b/include/haproxy/log-t.h @@ -174,6 +174,10 @@ struct logformat_node { const struct logformat_tag *tag; // set if ->type == LOG_FMT_TAG }; +/* returns true if the node options may be set (according to it's type) */ +#define LF_NODE_WITH_OPT(node) \ + (node->type == LOG_FMT_EXPR || node->type == LOG_FMT_TAG) + enum lf_expr_flags { LF_FL_NONE = 0x00, LF_FL_COMPILED = 0x01 diff --git a/src/log.c b/src/log.c index a7cc713fc..2cde78831 100644 --- a/src/log.c +++ b/src/log.c @@ -932,7 +932,7 @@ int lf_expr_postcheck(struct lf_expr *lf_expr, struct proxy *px, char **err) px->to_log |= lf->tag->lw; } next_node: - if (lf->type == LOG_FMT_EXPR || lf->type == LOG_FMT_TAG) { + if (LF_NODE_WITH_OPT(lf)) { /* For configurable nodes, apply current node's option * mask to global node options to keep options common * to all nodes @@ -3642,7 +3642,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t /* types that cannot be named such as text or separator are ignored * when encoding is set */ - if (tmp->type != LOG_FMT_EXPR && tmp->type != LOG_FMT_TAG) + if (!LF_NODE_WITH_OPT(tmp)) goto next_fmt; if (!tmp->name)