alert/eve: remove jansson specific feature (jsonbuilder prep)

Remove the Jansson specific feature of being able to delete
an object from json_t, in prep for refactors to JsonBuilder.

Instead create a new header for each alert to be logged.
pull/5012/head
Jason Ish 6 years ago committed by Victor Julien
parent f4f1fdbf86
commit cc4f9d7f3d

@ -405,18 +405,18 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
if (p->alerts.cnt == 0 && !(p->flags & PKT_HAS_TAG))
return TM_ECODE_OK;
json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "alert");
if (unlikely(js == NULL))
return TM_ECODE_OK;
JsonAddCommonOptions(&json_output_ctx->cfg, p, p->flow, js);
for (i = 0; i < p->alerts.cnt; i++) {
const PacketAlert *pa = &p->alerts.alerts[i];
if (unlikely(pa->s == NULL)) {
continue;
}
json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "alert");
if (unlikely(js == NULL))
return TM_ECODE_OK;
JsonAddCommonOptions(&json_output_ctx->cfg, p, p->flow, js);
MemBufferReset(aft->json_buffer);
/* alert */
@ -596,10 +596,8 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
}
OutputJSONBuffer(js, aft->file_ctx, &aft->json_buffer);
json_object_del(js, "alert");
}
json_object_clear(js);
json_decref(js);
}
if ((p->flags & PKT_HAS_TAG) && (json_output_ctx->flags &
LOG_JSON_TAGGED_PACKETS)) {

Loading…
Cancel
Save