new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / analysisd / output / jsonout.c
diff --git a/src/analysisd/output/jsonout.c b/src/analysisd/output/jsonout.c
new file mode 100644 (file)
index 0000000..237be3d
--- /dev/null
@@ -0,0 +1,37 @@
+/* Copyright (C) 2015 Trend Micro Inc.
+ * All rights reserved.
+ *
+ * This program is a free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public
+ * License (version 2) as published by the FSF - Free Software
+ * Foundation.
+ */
+
+#include "jsonout.h"
+#include "alerts/getloglocation.h"
+#include "format/to_json.h"
+
+void jsonout_output_event(const Eventinfo *lf)
+{
+    char *json_alert = Eventinfo_to_jsonstr(lf);
+
+    fprintf(_jflog,
+            "%s\n",
+            json_alert);
+
+    fflush(_jflog);
+    free(json_alert);
+    return;
+}
+void jsonout_output_archive(const Eventinfo *lf)
+{
+    char *json_alert = Archiveinfo_to_jsonstr(lf);
+
+    fprintf(_ejflog,
+            "%s\n",
+            json_alert);
+
+    fflush(_ejflog);
+    free(json_alert);
+    return;
+}