]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
eve: flow: global metadata config
authorJason Ish <ish@unx.ca>
Mon, 11 Dec 2017 21:50:36 +0000 (15:50 -0600)
committerVictor Julien <victor@inliniac.net>
Tue, 30 Jan 2018 13:43:51 +0000 (14:43 +0100)
src/output-json-flow.c

index dee2f6ff5af3273380b0b2e0791413dfec8db9ce..47516d6413d8e0997cb26463c003ee1d7cf106b7 100644 (file)
@@ -54,6 +54,7 @@
 typedef struct LogJsonFileCtx_ {
     LogFileCtx *file_ctx;
     uint32_t flags; /** Store mode */
+    bool include_metadata;
 } LogJsonFileCtx;
 
 typedef struct JsonFlowLogThread_ {
@@ -208,9 +209,7 @@ void JsonAddFlow(Flow *f, json_t *js, json_t *hjs)
 /* JSON format logging */
 static void JsonFlowLogJSON(JsonFlowLogThread *aft, json_t *js, Flow *f)
 {
-#if 0
     LogJsonFileCtx *flow_ctx = aft->flowlog_ctx;
-#endif
     json_t *hjs = json_object();
     if (hjs == NULL) {
         return;
@@ -272,6 +271,9 @@ static void JsonFlowLogJSON(JsonFlowLogThread *aft, json_t *js, Flow *f)
 
     json_object_set_new(js, "flow", hjs);
 
+    if (flow_ctx->include_metadata) {
+        JsonAddMetadata(NULL, f, js);
+    }
 
     /* TCP */
     if (f->proto == IPPROTO_TCP) {
@@ -436,6 +438,7 @@ static OutputInitResult OutputFlowLogInitSub(ConfNode *conf, OutputCtx *parent_c
     }
 
     flow_ctx->file_ctx = ojc->file_ctx;
+    flow_ctx->include_metadata = ojc->include_metadata;
 
     output_ctx->data = flow_ctx;
     output_ctx->DeInit = OutputFlowLogDeinitSub;