|
|
|
|
@ -65,6 +65,7 @@
|
|
|
|
|
typedef struct JsonDropOutputCtx_ {
|
|
|
|
|
LogFileCtx *file_ctx;
|
|
|
|
|
uint8_t flags;
|
|
|
|
|
bool include_metadata;
|
|
|
|
|
} JsonDropOutputCtx;
|
|
|
|
|
|
|
|
|
|
typedef struct JsonDropLogThread_ {
|
|
|
|
|
@ -86,11 +87,16 @@ static int g_droplog_flows_start = 1;
|
|
|
|
|
*/
|
|
|
|
|
static int DropLogJSON (JsonDropLogThread *aft, const Packet *p)
|
|
|
|
|
{
|
|
|
|
|
JsonDropOutputCtx *drop_ctx = aft->drop_ctx;
|
|
|
|
|
uint16_t proto = 0;
|
|
|
|
|
json_t *js = CreateJSONHeader((Packet *)p, 0, "drop");//TODO const
|
|
|
|
|
if (unlikely(js == NULL))
|
|
|
|
|
return TM_ECODE_OK;
|
|
|
|
|
|
|
|
|
|
if (drop_ctx->include_metadata) {
|
|
|
|
|
JsonAddMetadata(p, p->flow, js);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
json_t *djs = json_object();
|
|
|
|
|
if (unlikely(djs == NULL)) {
|
|
|
|
|
json_decref(js);
|
|
|
|
|
@ -350,6 +356,7 @@ static OutputInitResult JsonDropLogInitCtxSub(ConfNode *conf, OutputCtx *parent_
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
drop_ctx->file_ctx = ajt->file_ctx;
|
|
|
|
|
drop_ctx->include_metadata = ajt->include_metadata;
|
|
|
|
|
|
|
|
|
|
output_ctx->data = drop_ctx;
|
|
|
|
|
output_ctx->DeInit = JsonDropLogDeInitCtxSub;
|
|
|
|
|
|