void RulesDumpMatchArray(const DetectEngineThreadCtx *det_ctx,
const SigGroupHead *sgh, const Packet *p)
{
- json_t *js = CreateJSONHeader(p, 0, "inspectedrules");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "inspectedrules");
if (js == NULL)
return;
json_t *ir = json_object();
if (p->alerts.cnt == 0 && !(p->flags & PKT_HAS_TAG))
return TM_ECODE_OK;
- json_t *js = CreateJSONHeader(p, 0, "alert");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "alert");
if (unlikely(js == NULL))
return TM_ECODE_OK;
if ((p->flags & PKT_HAS_TAG) && (json_output_ctx->flags &
LOG_JSON_TAGGED_PACKETS)) {
MemBufferReset(aft->json_buffer);
- json_t *packetjs = CreateJSONHeader(p, 0, "packet");
+ json_t *packetjs = CreateJSONHeader(p, LOG_DIR_PACKET, "packet");
if (unlikely(packetjs != NULL)) {
AlertJsonPacket(p, packetjs);
OutputJSONBuffer(packetjs, aft->file_ctx, &aft->json_buffer);
MemBufferReset(buffer);
if (tx->has_request && tx->request_done) {
- json_t *js = CreateJSONHeader(p, 1, "dnp3");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_FLOW, "dnp3");
if (unlikely(js == NULL)) {
return TM_ECODE_OK;
}
MemBufferReset(buffer);
if (tx->has_response && tx->response_done) {
- json_t *js = CreateJSONHeader(p, 1, "dnp3");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_FLOW, "dnp3");
if (unlikely(js == NULL)) {
return TM_ECODE_OK;
}
#ifdef HAVE_RUST
for (uint16_t i = 0; i < 0xffff; i++) {
- js = CreateJSONHeader(p, 1, "dns");
+ js = CreateJSONHeader(p, LOG_DIR_PACKET, "dns");
if (unlikely(js == NULL)) {
return TM_ECODE_OK;
}
DNSTransaction *tx = txptr;
DNSQueryEntry *query = NULL;
TAILQ_FOREACH(query, &tx->query_list, next) {
- js = CreateJSONHeader(p, 1, "dns");
+ js = CreateJSONHeader(p, LOG_DIR_PACKET, "dns");
if (unlikely(js == NULL))
return TM_ECODE_OK;
if (dnslog_ctx->include_metadata) {
LogDnsLogThread *td = (LogDnsLogThread *)thread_data;
LogDnsFileCtx *dnslog_ctx = td->dnslog_ctx;
- json_t *js;
if (unlikely(dnslog_ctx->flags & LOG_ANSWERS) == 0) {
return TM_ECODE_OK;
}
- js = CreateJSONHeader(p, 0, "dns");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "dns");
+ if (unlikely(js == NULL))
+ return TM_ECODE_OK;
if (dnslog_ctx->include_metadata) {
JsonAddMetadata(p, f, js);
}
#else
DNSTransaction *tx = txptr;
- if (unlikely(js == NULL))
- return TM_ECODE_OK;
LogAnswers(td, js, tx, tx_id);
#endif
static int DropLogJSON (JsonDropLogThread *aft, const Packet *p)
{
JsonDropOutputCtx *drop_ctx = aft->drop_ctx;
- uint16_t proto = 0;
- json_t *js = CreateJSONHeader(p, 0, "drop");
+
+ json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "drop");
if (unlikely(js == NULL))
return TM_ECODE_OK;
/* reset */
MemBufferReset(aft->buffer);
+ uint16_t proto = 0;
if (PKT_IS_IPV4(p)) {
json_object_set_new(djs, "len", json_integer(IPV4_GET_IPLEN(p)));
json_object_set_new(djs, "tos", json_integer(IPV4_GET_IPTOS(p)));
json_t *JsonBuildFileInfoRecord(const Packet *p, const File *ff,
const bool stored)
{
- json_t *js = CreateJSONHeader(p, 0, "fileinfo");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "fileinfo");
json_t *hjs = NULL;
if (unlikely(js == NULL))
return NULL;
htp_tx_t *tx = txptr;
JsonHttpLogThread *jhl = (JsonHttpLogThread *)thread_data;
- json_t *js = CreateJSONHeaderWithTxId(p, 1, "http", tx_id);
+ json_t *js = CreateJSONHeaderWithTxId(p, LOG_DIR_FLOW, "http", tx_id);
if (unlikely(js == NULL))
return TM_ECODE_OK;
static int MetadataJson(ThreadVars *tv, JsonMetadataLogThread *aft, const Packet *p)
{
- json_t *js = CreateJSONHeader(p, 0, "metadata");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "metadata");
if (unlikely(js == NULL))
return TM_ECODE_OK;
{
NFSTransaction *nfstx = tx;
LogNFSLogThread *thread = thread_data;
- json_t *js, *nfsjs;
if (rs_nfs_tx_logging_is_filtered(nfstx))
return TM_ECODE_OK;
- js = CreateJSONHeader(p, 0, "nfs");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "nfs");
if (unlikely(js == NULL)) {
return TM_ECODE_FAILED;
}
}
json_object_set_new(js, "rpc", rpcjs);
- nfsjs = rs_nfs_log_json_response(state, tx);
+ json_t *nfsjs = rs_nfs_log_json_response(state, tx);
if (unlikely(nfsjs == NULL)) {
goto error;
}
SCEnter();
JsonEmailLogThread *jhl = (JsonEmailLogThread *)thread_data;
- json_t *js = CreateJSONHeaderWithTxId(p, 1, "smtp", tx_id);
+ json_t *js = CreateJSONHeaderWithTxId(p, LOG_DIR_FLOW, "smtp", tx_id);
if (unlikely(js == NULL))
return TM_ECODE_OK;
ssh_state->srv_hdr.software_version == NULL)
return 0;
- json_t *js = CreateJSONHeader(p, 1, "ssh");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_FLOW, "ssh");
if (unlikely(js == NULL))
return 0;
SCLogNotice("Logging template transaction %"PRIu64".", templatetx->tx_id);
- json_t *js = CreateJSONHeader(p, 0, "template");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "template");
if (unlikely(js == NULL)) {
return TM_ECODE_FAILED;
}
{
LogTFTPLogThread *thread = thread_data;
- json_t *js = CreateJSONHeader(p, 0, "tftp");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "tftp");
if (unlikely(js == NULL)) {
return TM_ECODE_FAILED;
}
return 0;
}
- json_t *js = CreateJSONHeader(p, 1, "tls");
+ json_t *js = CreateJSONHeader(p, LOG_DIR_FLOW, "tls");
if (unlikely(js == NULL)) {
return 0;
}