Skip to content

Commit 32634bd

Browse files
committed
eve: log app_proto in all event types
There was a regression between Suricata 7 and Suricata 8. The app_proto was logged in almost all events in 7 and is only log in a small subset (fileinfo, flow, frame, netflow) in 8. This patch updates the code to log app_proto in all events if there is a Flow available. It is making use of EveAddAppProto function to get interesting information such as original application protocol or difference between server and client side. Ticket: #7888
1 parent c4685ec commit 32634bd

File tree

5 files changed

+3
-7
lines changed

5 files changed

+3
-7
lines changed

src/output-json-alert.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,6 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
722722
}
723723
}
724724

725-
EveAddAppProto(p->flow, jb);
726-
727725
if (p->flowflags & FLOW_PKT_TOSERVER) {
728726
SCJbSetString(jb, "direction", "to_server");
729727
} else {

src/output-json-file.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ SCJsonBuilder *JsonBuildFileInfoRecord(const Packet *p, const File *ff, void *tx
189189
break;
190190
}
191191

192-
SCJbSetString(js, "app_proto", AppProtoToString(p->flow->alproto));
193-
194192
SCJbOpenObject(js, "fileinfo");
195193
if (stored) {
196194
// the file has just been stored on disk cf OUTPUT_FILEDATA_FLAG_CLOSE

src/output-json-frame.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ static int FrameJsonUdp(ThreadVars *tv, JsonFrameLogThread *aft, const Packet *p
313313
if (unlikely(jb == NULL))
314314
return TM_ECODE_OK;
315315

316-
SCJbSetString(jb, "app_proto", AppProtoToString(f->alproto));
317316
FrameJsonLogOneFrame(IPPROTO_UDP, frame, p->flow, NULL, p, jb, aft->payload_buffer);
318317
OutputJsonBuilderBuffer(tv, p, p->flow, jb, aft->ctx);
319318
SCJbFree(jb);
@@ -387,7 +386,6 @@ static int FrameJson(ThreadVars *tv, JsonFrameLogThread *aft, const Packet *p)
387386
if (unlikely(jb == NULL))
388387
return TM_ECODE_OK;
389388

390-
SCJbSetString(jb, "app_proto", AppProtoToString(p->flow->alproto));
391389
FrameJsonLogOneFrame(IPPROTO_TCP, frame, p->flow, stream, p, jb, aft->payload_buffer);
392390
OutputJsonBuilderBuffer(tv, p, p->flow, jb, aft->ctx);
393391
SCJbFree(jb);

src/output-json-netflow.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static void NetFlowLogEveToServer(SCJsonBuilder *js, Flow *f)
228228

229229
static void NetFlowLogEveToClient(SCJsonBuilder *js, Flow *f)
230230
{
231-
SCJbSetString(js, "app_proto", AppProtoToString(f->alproto_tc ? f->alproto_tc : f->alproto));
231+
EveAddAppProto(f, js);
232232

233233
SCJbOpenObject(js, "netflow");
234234

src/output-json.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,8 @@ SCJsonBuilder *CreateEveHeader(const Packet *p, enum SCOutputJsonLogDirection di
886886

887887
CreateEveFlowId(js, f);
888888

889+
EveAddAppProto(f, js);
890+
889891
/* sensor id */
890892
if (sensor_id >= 0) {
891893
SCJbSetUint(js, "sensor_id", sensor_id);

0 commit comments

Comments
 (0)