error was at byte 23. This is the slash ('/') in header name
"header/bizarre", which is not a valid HTTP character for a header name.
-show events [-[wn0rs]*] [<sink>]
+show events [-[wun0rs]*] [<sink>]
With no option, this lists all known event sinks and their types. Arguments
not starting with "-" are taken for a sink name, whose events will be dumped
if it is of type buffer. The command also supports a variety of options
events and display them. It is possible to stop the operation by
entering any input (which will be discarded) or by closing the session.
Note that using "echo show events -w | socat ..." does close the input
- and interrupt the dump.
+ and interrupt the dump; see '-u' option instead in this case.
+
+ -u executes the command as an uninterruptible job. This is useful when
+ using utilities such as 'socat' to continue running after a half-close
+ of the CLI input. The command will still be stopped in this case if a
+ send error occurs while dumping new events or if no events are detected
+ after a delay based on the configured stats timeout.
+
+ Example :
+ $ echo "show events -u buf0" | socat -t10 - /var/run/haproxy.sock
show fd [-!plcfbs]* [[<tgid>]/[<fd>] | <fd>]
Dump the list of either all open file descriptors or just the one number <fd>
struct sink *sink;
const char *name = NULL;
uint ring_flags;
- int arg;
+ int arg, ret, unintr = 0;
ring_flags = 0;
for (arg = 2; *args[arg]; arg++) {
case '0' : ring_flags |= RING_WF_END_ZERO; break;
case 'n' : ring_flags |= RING_WF_SEEK_NEW; break;
case 'w' : ring_flags |= RING_WF_WAIT_MODE; break;
+ case 'u' : ring_flags |= RING_WF_WAIT_MODE; unintr = 1; break;
case 's' : ring_flags |= RING_WF_SANITIZE; break;
case 'r' : ring_flags &= ~RING_WF_SANITIZE; break;
case 'h' : goto show_help;
if (!name) {
/* no arg => report the list of supported sink */
show_help:
- chunk_printf(&trash, "Supported events sinks are listed below. Add combinations of -0(zero), -w(wait), -n(new), -r(raw), -s(anitize). Any key to stop.\n");
+ chunk_printf(&trash, "Supported events sinks are listed below. Add combinations of -0(zero), -w(wait), -u(ninterruptible), -n(new), -r(raw), -s(anitize). Any key to stop.\n");
list_for_each_entry(sink, &sink_list, sink_list) {
chunk_appendf(&trash, " %-10s : type=%s, %u dropped, %s\n",
sink->name,
if (sink->type != SINK_TYPE_BUFFER)
return cli_msg(appctx, LOG_NOTICE, "Nothing to report for this sink");
- return ring_attach_cli(sink->ctx.ring, appctx, ring_flags);
+ if (unintr && cli_inc_unintr(appctx))
+ return cli_err(appctx, "Cannot start a new uninterruptible job");
+
+ ret = ring_attach_cli(sink->ctx.ring, appctx, ring_flags);
+ if (ret && unintr) {
+ /* attach failure, decrement uninterruptible job counter */
+ cli_dec_unintr(appctx);
+ }
+ return ret;
}
/* Pre-configures a ring proxy to emit connections */
REGISTER_POST_DEINIT(sink_deinit);
static struct cli_kw_list cli_kws = {{ },{
- { { "show", "events", NULL }, "show events [-0hnrsw]* [<sink>] : show event sink state", cli_parse_show_events, NULL, NULL },
+ { { "show", "events", NULL }, "show events [-0hnrswu]* [<sink>] : show event sink state", cli_parse_show_events, NULL, NULL },
{{},}
}};