From bd3fdeb53fa7237f8bb087b0a30e245c1724715e Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 5 Jun 2020 06:58:55 +0200 Subject: [PATCH] eve/alert: clean up decoder event logging --- src/output-json-alert.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/output-json-alert.c b/src/output-json-alert.c index 528154e00b..004c2ddbaa 100644 --- a/src/output-json-alert.c +++ b/src/output-json-alert.c @@ -650,16 +650,14 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p) static int AlertJsonDecoderEvent(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p) { - int i; char timebuf[64]; - json_t *js; if (p->alerts.cnt == 0) return TM_ECODE_OK; CreateIsoTimeString(&p->ts, timebuf, sizeof(timebuf)); - for (i = 0; i < p->alerts.cnt; i++) { + for (int i = 0; i < p->alerts.cnt; i++) { MemBufferReset(aft->json_buffer); const PacketAlert *pa = &p->alerts.alerts[i]; @@ -674,7 +672,7 @@ static int AlertJsonDecoderEvent(ThreadVars *tv, JsonAlertLogThread *aft, const action = "blocked"; } - js = json_object(); + json_t *js = json_object(); if (js == NULL) return TM_ECODE_OK; @@ -687,13 +685,6 @@ static int AlertJsonDecoderEvent(ThreadVars *tv, JsonAlertLogThread *aft, const /* time & tx */ json_object_set_new(js, "timestamp", json_string(timebuf)); - /* tuple */ - //json_object_set_new(js, "srcip", json_string(srcip)); - //json_object_set_new(js, "sp", json_integer(p->sp)); - //json_object_set_new(js, "dstip", json_string(dstip)); - //json_object_set_new(js, "dp", json_integer(p->dp)); - //json_object_set_new(js, "proto", json_integer(proto)); - json_object_set_new(ajs, "action", json_string(action)); json_object_set_new(ajs, "gid", json_integer(pa->s->gid)); json_object_set_new(ajs, "signature_id", json_integer(pa->s->id));