mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
MINOR: cli: make "show errors" support a proxy name
Till now it was needed to know the proxy's ID while we do have the ability to look up a proxy by its name now.
This commit is contained in:
parent
a1b1ed53e7
commit
234ba2d8eb
@ -1684,12 +1684,13 @@ show env [<name>]
|
||||
ensure that they contain the expected values. This command is restricted and
|
||||
can only be issued on sockets configured for levels "operator" or "admin".
|
||||
|
||||
show errors [<iid>]
|
||||
show errors [<iid>|<proxy>]
|
||||
Dump last known request and response errors collected by frontends and
|
||||
backends. If <iid> is specified, the limit the dump to errors concerning
|
||||
either frontend or backend whose ID is <iid>. This command is restricted
|
||||
and can only be issued on sockets configured for levels "operator" or
|
||||
"admin".
|
||||
either frontend or backend whose ID is <iid>. Proxy ID "-1" will cause
|
||||
all instances to be dumped. If a proxy name is specified instead, its ID
|
||||
will be used as the filter. This command is restricted and can only be
|
||||
issued on sockets configured for levels "operator" or "admin".
|
||||
|
||||
The errors which may be collected are the last request and response errors
|
||||
caused by protocol violations, often due to invalid characters in header
|
||||
|
@ -12907,10 +12907,24 @@ static int cli_parse_show_errors(char **args, struct appctx *appctx, void *priva
|
||||
if (!cli_has_level(appctx, ACCESS_LVL_OPER))
|
||||
return 1;
|
||||
|
||||
if (*args[2])
|
||||
appctx->ctx.errors.iid = atoi(args[2]);
|
||||
if (*args[2]) {
|
||||
struct proxy *px;
|
||||
|
||||
px = proxy_find_by_name(args[2], 0, 0);
|
||||
if (px)
|
||||
appctx->ctx.errors.iid = px->uuid;
|
||||
else
|
||||
appctx->ctx.errors.iid = atoi(args[2]);
|
||||
|
||||
if (!appctx->ctx.errors.iid) {
|
||||
appctx->ctx.cli.msg = "No such proxy.\n";
|
||||
appctx->st0 = CLI_ST_PRINT;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
appctx->ctx.errors.iid = -1;
|
||||
appctx->ctx.errors.iid = -1; // dump all proxies
|
||||
|
||||
appctx->ctx.errors.px = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user