output/json-alert: add sip metadata

Put SIP information to alert event.
pull/4210/head
Giuseppe Longo 8 years ago committed by Victor Julien
parent edc2a583a9
commit c88559dc72

@ -67,6 +67,7 @@
#include "output-json-nfs.h"
#include "output-json-smb.h"
#include "output-json-flow.h"
#include "output-json-sip.h"
#include "util-byte.h"
#include "util-privs.h"
@ -473,6 +474,10 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
hjs = JsonSMBAddMetadata(p->flow, pa->tx_id);
if (hjs)
json_object_set_new(js, "smb", hjs);
} else if (proto == ALPROTO_SIP) {
hjs = JsonSIPAddMetadata(p->flow, pa->tx_id);
if (hjs)
json_object_set_new(js, "sip", hjs);
}
#endif
if (proto == ALPROTO_FTPDATA) {

@ -62,6 +62,19 @@ typedef struct LogSIPLogThread_ {
MemBuffer *buffer;
} LogSIPLogThread;
json_t *JsonSIPAddMetadata(const Flow *f, uint64_t tx_id)
{
SIPState *state = FlowGetAppState(f);
if (state) {
SIPTransaction *tx = AppLayerParserGetTx(f->proto, ALPROTO_SIP, state, tx_id);
if (tx) {
return rs_sip_log_json(state, tx);
}
}
return NULL;
}
static int JsonSIPLogger(ThreadVars *tv, void *thread_data,
const Packet *p, Flow *f, void *state, void *tx, uint64_t tx_id)
{

@ -26,4 +26,8 @@
void JsonSIPLogRegister(void);
#ifdef HAVE_LIBJANSSON
json_t *JsonSIPAddMetadata(const Flow *f, uint64_t tx_id);
#endif /* HAVE_LIBJANSSON */
#endif /* __OUTPUT_JSON_SIP_H__ */

Loading…
Cancel
Save