summaryrefslogtreecommitdiffstats
path: root/src/vlib/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/main.c')
-rw-r--r--src/vlib/main.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index 422d3e2634b..8af1e7a93cc 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -707,6 +707,24 @@ elog_save_buffer (vlib_main_t * vm,
return error;
}
+void
+elog_post_mortem_dump (void)
+{
+ vlib_main_t *vm = &vlib_global_main;
+ elog_main_t *em = &vm->elog_main;
+ u8 *filename;
+ clib_error_t *error;
+
+ if (!vm->elog_post_mortem_dump)
+ return;
+
+ filename = format (0, "/tmp/elog_post_mortem.%d%c", getpid (), 0);
+ error = elog_write_file (em, (char *) filename, 1 /* flush ring */ );
+ if (error)
+ clib_error_report (error);
+ vec_free (filename);
+}
+
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (elog_save_cli, static) = {
.path = "event-logger save",
@@ -1642,6 +1660,8 @@ vlib_main_configure (vlib_main_t * vm, unformat_input_t * input)
else if (unformat (input, "elog-events %d",
&vm->elog_main.event_ring_size))
;
+ else if (unformat (input, "elog-post-mortem-dump"))
+ vm->elog_post_mortem_dump = 1;
else
return unformat_parse_error (input);
}