the last one that was created before the command was entered; those which
die in the mean time will not appear.
-show sess <id> | older <age> | all
+show sess <id> | older <age> | susp | all
Display a lot of internal information about the matching sessions. In the
first form, only the session matching the specified session identifier will
be shown. This identifier is the first field at the beginning of the lines in
the dumps of "show sess" (it corresponds to the session pointer). In the
second form, only sessions older than <age> (in seconds by default) will be
- shown. If "all" is used instead, then all sessions will be dumped. Dumping
+ shown. Passing "susp" instead will only report entries that are considered as
+ suspicious by the developers based on criteria that may in time or vary along
+ versions. If "all" is used instead, then all sessions will be dumped. Dumping
many sessions can produce a huge output, take a lot of time and be CPU
intensive, so it's always better to only dump the minimum needed. Those
information are useless to most users but may be used by haproxy developers
}
/* appctx context used by the "show sess" command */
+/* flags used for show_sess_ctx.flags */
+#define CLI_SHOWSESS_F_SUSP 0x00000001 /* show only suspicious streams */
struct show_sess_ctx {
struct bref bref; /* back-reference from the session being dumped */
unsigned int thr; /* the thread number being explored (0..MAX_THREADS-1) */
unsigned int uid; /* if non-null, the uniq_id of the session being dumped */
unsigned int min_age; /* minimum age of streams to dump */
+ unsigned int flags; /* CLI_SHOWSESS_* */
int section; /* section of the session being dumped */
int pos; /* last position of the current session's buffer */
};
ctx->min_age = timeout;
ctx->target = (void *)-1; /* show all matching entries */
}
+ else if (*args[2] && strcmp(args[2], "susp") == 0) {
+ ctx->flags |= CLI_SHOWSESS_F_SUSP;
+ ctx->target = (void *)-1; /* show all matching entries */
+ }
else if (*args[2] && strcmp(args[2], "all") == 0)
ctx->target = (void *)-1;
else if (*args[2])
goto next_sess;
}
+ if (ctx->flags & CLI_SHOWSESS_F_SUSP) {
+ /* only show suspicious streams. Non-suspicious ones have a valid
+ * expiration date in the future and a valid front endpoint.
+ */
+ if (curr_strm->task->expire &&
+ !tick_is_expired(curr_strm->task->expire, now_ms) &&
+ curr_strm->scf && curr_strm->scf->sedesc && curr_strm->scf->sedesc->se)
+ goto next_sess;
+ }
+
if (ctx->target) {
if (ctx->target != (void *)-1 && ctx->target != curr_strm)
goto next_sess;
/* register cli keywords */
static struct cli_kw_list cli_kws = {{ },{
- { { "show", "sess", NULL }, "show sess [<id>|all|older <age>] : report the list of current sessions or dump this exact session", cli_parse_show_sess, cli_io_handler_dump_sess, cli_release_show_sess },
+ { { "show", "sess", NULL }, "show sess [<id>|all|susp|older <age>] : report the list of current sessions or dump this exact session", cli_parse_show_sess, cli_io_handler_dump_sess, cli_release_show_sess },
{ { "shutdown", "session", NULL }, "shutdown session [id] : kill a specific session", cli_parse_shutdown_session, NULL, NULL },
{ { "shutdown", "sessions", "server" }, "shutdown sessions server <bk>/<srv> : kill sessions on a server", cli_parse_shutdown_sessions_server, NULL, NULL },
{{},}