output-json: add create header with tx function

To be able to correlate between events, it is better to have the
tx_id information in the root object. This function adds a new
function to automate the addition of the field.
pull/1671/head
Eric Leblond 10 years ago
parent 96412e8921
commit 113d6a3950

@ -327,6 +327,18 @@ json_t *CreateJSONHeader(Packet *p, int direction_sensitive, char *event_type)
return js;
}
json_t *CreateJSONHeaderWithTxId(Packet *p, int direction_sensitive, char *event_type, uint32_t tx_id)
{
json_t *js = CreateJSONHeader(p, direction_sensitive, event_type);
if (unlikely(js == NULL))
return NULL;
/* tx id for correlation with other events */
json_object_set_new(js, "tx_id", json_integer(tx_id));
return js;
}
int OutputJSONBuffer(json_t *js, LogFileCtx *file_ctx, MemBuffer *buffer)
{
char *js_s = json_dumps(js,

@ -35,6 +35,7 @@ void TmModuleOutputJsonRegister (void);
void CreateJSONFlowId(json_t *js, const Flow *f);
void JsonTcpFlags(uint8_t flags, json_t *js);
json_t *CreateJSONHeader(Packet *p, int direction_sensative, char *event_type);
json_t *CreateJSONHeaderWithTxId(Packet *p, int direction_sensitive, char *event_type, uint32_t tx_id);
TmEcode OutputJSON(json_t *js, void *data, uint64_t *count);
int OutputJSONBuffer(json_t *js, LogFileCtx *file_ctx, MemBuffer *buffer);
OutputCtx *OutputJsonInitCtx(ConfNode *);

Loading…
Cancel
Save