diff --git a/src/log.c b/src/log.c index ff1ab9a81..0d6e7fd33 100644 --- a/src/log.c +++ b/src/log.c @@ -29,9 +29,12 @@ #include #include +#include #include #include +#include +#include #include #include #include @@ -2380,6 +2383,31 @@ void strm_log(struct stream *s) } } +static int cli_io_handler_show_startup_logs(struct appctx *appctx) +{ + struct stream_interface *si = appctx->owner; + const char *msg = (startup_logs ? startup_logs : "No startup alerts/warnings.\n"); + + if (ci_putstr(si_ic(si), msg) == -1) { + si_applet_cant_put(si); + return 0; + } + return 1; +} + +/* register cli keywords */ +static struct cli_kw_list cli_kws = {{ },{ + { { "show", "startup-logs", NULL }, + "show startup-logs : report logs emitted during HAProxy startup", + NULL, cli_io_handler_show_startup_logs }, + {{},} +}}; + +__attribute__((constructor)) +static void __log_init(void) +{ + cli_register_kw(&cli_kws); +} /* * Local variables: * c-indent-level: 8