mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-19 21:45:33 +00:00
MINOR: http/conf: store the use_backend configuration file and line for logs
The error log of the directive use_backend doesn't provide the file and line containing the declaration. This patch stores theses informations.
This commit is contained in:
parent
5948b01149
commit
4ed1c9585d
@ -77,6 +77,7 @@ enum {
|
|||||||
ARGC_CAP, /* capture rule */
|
ARGC_CAP, /* capture rule */
|
||||||
ARGC_SRV, /* server line */
|
ARGC_SRV, /* server line */
|
||||||
ARGC_SPOE, /* spoe message args */
|
ARGC_SPOE, /* spoe message args */
|
||||||
|
ARGC_UBK, /* use_backend message */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* flags used when compiling and executing regex */
|
/* flags used when compiling and executing regex */
|
||||||
|
@ -446,6 +446,8 @@ struct switching_rule {
|
|||||||
char *name; /* target backend name during config parsing */
|
char *name; /* target backend name during config parsing */
|
||||||
struct list expr; /* logformat expression to use for dynamic rules */
|
struct list expr; /* logformat expression to use for dynamic rules */
|
||||||
} be;
|
} be;
|
||||||
|
char *file;
|
||||||
|
int line;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct server_rule {
|
struct server_rule {
|
||||||
|
@ -4018,6 +4018,12 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||||||
}
|
}
|
||||||
rule->cond = cond;
|
rule->cond = cond;
|
||||||
rule->be.name = strdup(args[1]);
|
rule->be.name = strdup(args[1]);
|
||||||
|
rule->line = linenum;
|
||||||
|
rule->file = strdup(file);
|
||||||
|
if (!rule->file) {
|
||||||
|
Alert("Out of memory error.\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
LIST_INIT(&rule->list);
|
LIST_INIT(&rule->list);
|
||||||
LIST_ADDQ(&curproxy->switching_rules, &rule->list);
|
LIST_ADDQ(&curproxy->switching_rules, &rule->list);
|
||||||
}
|
}
|
||||||
@ -7792,6 +7798,9 @@ int check_config_validity()
|
|||||||
*/
|
*/
|
||||||
pxname = rule->be.name;
|
pxname = rule->be.name;
|
||||||
LIST_INIT(&rule->be.expr);
|
LIST_INIT(&rule->be.expr);
|
||||||
|
curproxy->conf.args.ctx = ARGC_UBK;
|
||||||
|
curproxy->conf.args.file = rule->file;
|
||||||
|
curproxy->conf.args.line = rule->line;
|
||||||
if (!parse_logformat_string(pxname, curproxy, &rule->be.expr, 0, SMP_VAL_FE_HRQ_HDR)) {
|
if (!parse_logformat_string(pxname, curproxy, &rule->be.expr, 0, SMP_VAL_FE_HRQ_HDR)) {
|
||||||
cfgerr++;
|
cfgerr++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -1482,6 +1482,7 @@ void deinit(void)
|
|||||||
if (rule->cond) {
|
if (rule->cond) {
|
||||||
prune_acl_cond(rule->cond);
|
prune_acl_cond(rule->cond);
|
||||||
free(rule->cond);
|
free(rule->cond);
|
||||||
|
free(rule->file);
|
||||||
}
|
}
|
||||||
free(rule);
|
free(rule);
|
||||||
}
|
}
|
||||||
|
@ -269,6 +269,8 @@ static inline const char *fmt_directive(const struct proxy *curproxy)
|
|||||||
return "server";
|
return "server";
|
||||||
case ARGC_SPOE:
|
case ARGC_SPOE:
|
||||||
return "spoe-message";
|
return "spoe-message";
|
||||||
|
case ARGC_UBK:
|
||||||
|
return "use_backend";
|
||||||
default:
|
default:
|
||||||
return "undefined(please report this bug)"; /* must never happen */
|
return "undefined(please report this bug)"; /* must never happen */
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user