them. It is possible to stop the operation by entering any input (which will
be discarded) or by closing the session. Finally, option "-n" is used to
directly seek to the end of the buffer, which is often convenient when
- combined with "-w" to only report new events. For convenience, "-wn" or "-nw"
- may be used to enable both options at once. By default, all events are
+ combined with "-w" to only report new events. By default, all events are
delimited by a line feed character ('\n' or 10 or 0x0A). It is possible to
change this to the NUL character ('\0' or 0) by passing the "-0" argument.
Option "-s" sanitizes the output, so that binary contents resulting from
not be interpreted as special (e.g. monitoring scripts whose output is copied
verbatim into reports). Finally, "-r" undoes "-s" and may be appended in
cases where "-s" was unconditionally appended, or as a future-proof way to
- ensure long-term compatibility in case the default changes.
+ ensure long-term compatibility in case the default changes. All options
+ starting with "-" may conveniently be combined (e.g. "-nsw").
show fd [-!plcfbs]* [[<tgid>]/[<fd>] | <fd>]
Dump the list of either all open file descriptors or just the one number <fd>
if (!*args[1]) {
/* no arg => report the list of supported sink */
- chunk_printf(&trash, "Supported events sinks are listed below. Add -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), -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,
ring_flags = 0;
for (arg = 2; *args[arg]; arg++) {
- if (strcmp(args[arg], "-w") == 0)
- ring_flags |= RING_WF_WAIT_MODE;
- else if (strcmp(args[arg], "-n") == 0)
- ring_flags |= RING_WF_SEEK_NEW;
- else if (strcmp(args[arg], "-0") == 0)
- ring_flags |= RING_WF_END_ZERO;
- else if (strcmp(args[arg], "-nw") == 0 || strcmp(args[arg], "-wn") == 0)
- ring_flags |= RING_WF_WAIT_MODE | RING_WF_SEEK_NEW;
- else if (strcmp(args[arg], "-s") == 0)
- ring_flags |= RING_WF_SANITIZE;
- else if (strcmp(args[arg], "-r") == 0)
- ring_flags &= ~RING_WF_SANITIZE;
- else
- return cli_err(appctx, "unknown option");
+ const char *p = args[arg];
+
+ if (*p != '-')
+ continue;
+
+ while (*++p) {
+ switch (*p) {
+ 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 's' : ring_flags |= RING_WF_SANITIZE; break;
+ case 'r' : ring_flags &= ~RING_WF_SANITIZE; break;
+ default: return cli_err(appctx, "unknown option");
+ }
+ }
}
return ring_attach_cli(sink->ctx.ring, appctx, ring_flags);
}
REGISTER_POST_DEINIT(sink_deinit);
static struct cli_kw_list cli_kws = {{ },{
- { { "show", "events", NULL }, "show events [<sink>] [-w] [-n] [-0] : show event sink state", cli_parse_show_events, NULL, NULL },
+ { { "show", "events", NULL }, "show events [<sink>] [-0nrsw]* : show event sink state", cli_parse_show_events, NULL, NULL },
{{},}
}};