output/json: update callers to use explicit directions

pull/3263/head
Victor Julien 8 years ago
parent 9f13365222
commit 710c7b821f

@ -60,7 +60,7 @@ SCMutex g_rule_dump_write_m = SCMUTEX_INITIALIZER;
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();

@ -389,7 +389,7 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
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;
@ -589,7 +589,7 @@ static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
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);

@ -312,7 +312,7 @@ static int JsonDNP3LoggerToServer(ThreadVars *tv, void *thread_data,
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;
}
@ -341,7 +341,7 @@ static int JsonDNP3LoggerToClient(ThreadVars *tv, void *thread_data,
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;
}

@ -663,7 +663,7 @@ static int JsonDnsLoggerToServer(ThreadVars *tv, void *thread_data,
#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;
}
@ -684,7 +684,7 @@ static int JsonDnsLoggerToServer(ThreadVars *tv, void *thread_data,
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) {
@ -707,13 +707,14 @@ static int JsonDnsLoggerToClient(ThreadVars *tv, void *thread_data,
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);
@ -747,8 +748,6 @@ static int JsonDnsLoggerToClient(ThreadVars *tv, void *thread_data,
}
#else
DNSTransaction *tx = txptr;
if (unlikely(js == NULL))
return TM_ECODE_OK;
LogAnswers(td, js, tx, tx_id);
#endif

@ -88,8 +88,8 @@ 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(p, 0, "drop");
json_t *js = CreateJSONHeader(p, LOG_DIR_PACKET, "drop");
if (unlikely(js == NULL))
return TM_ECODE_OK;
@ -106,6 +106,7 @@ static int DropLogJSON (JsonDropLogThread *aft, const Packet *p)
/* 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)));

@ -81,7 +81,7 @@ typedef struct JsonFileLogThread_ {
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;

@ -452,7 +452,7 @@ static int JsonHttpLogger(ThreadVars *tv, void *thread_data, const Packet *p, Fl
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;

@ -82,7 +82,7 @@ typedef struct JsonMetadataLogThread_ {
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;

@ -94,12 +94,11 @@ static int JsonNFSLogger(ThreadVars *tv, void *thread_data,
{
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;
}
@ -114,7 +113,7 @@ static int JsonNFSLogger(ThreadVars *tv, void *thread_data,
}
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;
}

@ -88,7 +88,7 @@ static int JsonSmtpLogger(ThreadVars *tv, void *thread_data, const Packet *p, Fl
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;

@ -106,7 +106,7 @@ static int JsonSshLogger(ThreadVars *tv, void *thread_data, const Packet *p,
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;

@ -74,7 +74,7 @@ static int JsonTemplateLogger(ThreadVars *tv, void *thread_data,
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;
}

@ -71,7 +71,7 @@ static int JsonTFTPLogger(ThreadVars *tv, void *thread_data,
{
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;
}

@ -357,7 +357,7 @@ static int JsonTlsLogger(ThreadVars *tv, void *thread_data, const Packet *p,
return 0;
}
json_t *js = CreateJSONHeader(p, 1, "tls");
json_t *js = CreateJSONHeader(p, LOG_DIR_FLOW, "tls");
if (unlikely(js == NULL)) {
return 0;
}

Loading…
Cancel
Save