Print this page
OS-1840 fmdump shall emit JSON (copyright fixes)
OS-1840 fmdump shall emit JSON (use library)
@@ -18,10 +18,11 @@
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/*
* Rendering functions for nvlist_prt that are of use to all types
* of log.
@@ -69,6 +70,19 @@
nvlist_prtctl_dofmt(pctl, NVLIST_FMT_MEMBER_NAME, name);
(void) fprintf(fp, "%s", fmristr);
topo_hdl_strfree(thp, fmristr);
return (1);
+}
+
+/*
+ * Thin wrapper around libnvpair's inbuilt JSON routine. Simply dumps the
+ * entire log record nvlist without any reformatting.
+ */
+int
+fmdump_print_json(fmd_log_t *lp, const fmd_log_record_t *rp, FILE *fp)
+{
+ nvlist_print_json(fp, rp->rec_nvl);
+ fprintf(fp, "\n");
+
+ return (0);
}