From: Eric Leblond Date: Mon, 20 Jan 2025 10:17:21 +0000 (+0100) Subject: eve/flow: log tx_cnt X-Git-Tag: suricata-8.0.0-rc1~457 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cf6459f3f12c2a274bee0b8372d4565e2366775;p=thirdparty%2Fsuricata.git eve/flow: log tx_cnt This patch adds a `tx_cnt` field to `netflow` events to give some context about the underlying protocol activity. Ticket: #7635 --- diff --git a/etc/schema.json b/etc/schema.json index 774bf36df5..24079a0c6a 100644 --- a/etc/schema.json +++ b/etc/schema.json @@ -1982,6 +1982,9 @@ }, "wrong_thread": { "type": "boolean" + }, + "tx_cnt": { + "type": "integer" } }, "additionalProperties": false diff --git a/src/output-json-flow.c b/src/output-json-flow.c index f62c117e49..c3b479bd05 100644 --- a/src/output-json-flow.c +++ b/src/output-json-flow.c @@ -27,6 +27,7 @@ #include "detect.h" #include "pkt-var.h" #include "conf.h" +#include "app-layer-parser.h" #include "threads.h" #include "threadvars.h" @@ -350,6 +351,13 @@ static void EveFlowLogJSON(OutputJsonThreadCtx *aft, SCJsonBuilder *jb, Flow *f) SCJbClose(jb); /* close array */ } + if (f->alstate) { + uint64_t tx_id = AppLayerParserGetTxCnt(f, f->alstate); + if (tx_id) { + SCJbSetUint(jb, "tx_cnt", tx_id); + } + } + /* Close flow. */ SCJbClose(jb);