suricata
output-json-anomaly.c
Go to the documentation of this file.
1 /* Copyright (C) 2019-2021 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Jeff Lucovsky <jeff@lucovsky.org>
22  *
23  * Logs anomalies in JSON format.
24  *
25  */
26 
27 #include "suricata-common.h"
28 #include "detect.h"
29 #include "flow.h"
30 #include "conf.h"
31 #include "app-layer.h"
32 #include "app-layer-events.h"
33 #include "app-layer-parser.h"
34 
35 #include "threads.h"
36 #include "tm-threads.h"
37 #include "threadvars.h"
38 #include "util-debug.h"
39 
40 #include "util-misc.h"
41 
42 #include "detect-parse.h"
43 #include "detect-engine.h"
44 #include "util-logopenfile.h"
45 
46 #include "output.h"
47 #include "output-json.h"
48 #include "output-json-anomaly.h"
49 
50 #include "util-byte.h"
51 #include "util-enum.h"
52 #include "util-privs.h"
53 #include "util-print.h"
54 #include "util-proto-name.h"
55 #include "util-buffer.h"
56 #include "util-validate.h"
57 
58 #define MODULE_NAME "JsonAnomalyLog"
59 
60 #define ANOMALY_EVENT_TYPE "anomaly"
61 #define LOG_JSON_DECODE_TYPE BIT_U16(0)
62 #define LOG_JSON_STREAM_TYPE BIT_U16(1)
63 #define LOG_JSON_APPLAYER_TYPE BIT_U16(2)
64 #define LOG_JSON_PACKETHDR BIT_U16(3)
65 
66 #define LOG_JSON_PACKET_TYPE (LOG_JSON_DECODE_TYPE | LOG_JSON_STREAM_TYPE)
67 #define ANOMALY_DEFAULTS LOG_JSON_APPLAYER_TYPE
68 
69 #define TX_ID_UNUSED UINT64_MAX
70 
71 typedef struct AnomalyJsonOutputCtx_ {
72  uint16_t flags;
75 
76 typedef struct JsonAnomalyLogThread_ {
80 
81 /*
82  * Restrict the anomaly logger count due to decoder state maintenance issues
83  */
84 
85 #define MAX_ANOMALY_LOGGERS 1
86 static int anomaly_loggers = 0;
87 static bool OutputAnomalyLoggerEnable(void)
88 {
89  if (anomaly_loggers < MAX_ANOMALY_LOGGERS) {
90  anomaly_loggers++;
91  return true;
92  }
93  return false;
94 }
95 
96 static void OutputAnomalyLoggerDisable(void)
97 {
98  if (anomaly_loggers)
99  anomaly_loggers--;
100 }
101 
102 static int AnomalyDecodeEventJson(ThreadVars *tv, JsonAnomalyLogThread *aft,
103  const Packet *p)
104 {
105  const uint16_t log_type = aft->json_output_ctx->flags;
106  const bool log_stream = log_type & LOG_JSON_STREAM_TYPE;
107  const bool log_decode = log_type & LOG_JSON_DECODE_TYPE;
108 
109  for (int i = 0; i < p->events.cnt; i++) {
110  uint8_t event_code = p->events.events[i];
111  bool is_decode = EVENT_IS_DECODER_PACKET_ERROR(event_code);
112  if (is_decode && !log_decode)
113  continue;
114  if (!is_decode && !log_stream)
115  continue;
116 
119  if (unlikely(js == NULL)) {
120  return TM_ECODE_OK;
121  }
122 
123  SCJbOpenObject(js, ANOMALY_EVENT_TYPE);
124 
125  if (event_code < DECODE_EVENT_MAX) {
126  const char *event = DEvents[event_code].event_name;
127  if (EVENT_IS_DECODER_PACKET_ERROR(event_code)) {
128  JB_SET_STRING(js, "type", "decode");
129  } else {
130  JB_SET_STRING(js, "type", "stream");
131  }
132  SCJbSetString(js, "event", event);
133  } else {
134  JB_SET_STRING(js, "type", "unknown");
135  SCJbSetUint(js, "code", event_code);
136  }
137 
138  /* Close anomaly object. */
139  SCJbClose(js);
140 
142  EvePacket(p, js, GET_PKT_LEN(p) < 32 ? GET_PKT_LEN(p) : 32);
143  }
144 
145  OutputJsonBuilderBuffer(tv, p, p->flow, js, aft->ctx);
146  SCJbFree(js);
147  }
148 
149  return TM_ECODE_OK;
150 }
151 
152 static int AnomalyAppLayerDecoderEventJson(ThreadVars *tv, JsonAnomalyLogThread *aft,
153  const Packet *p, AppLayerDecoderEvents *decoder_events, bool is_pktlayer, const char *layer,
154  uint64_t tx_id)
155 {
156  const char *alprotoname = AppLayerGetProtoName(p->flow->alproto);
157 
158  SCLogDebug("decoder_events %p event_count %d (last logged %d) %s",
159  decoder_events, decoder_events->cnt,
160  decoder_events->event_last_logged,
161  tx_id != TX_ID_UNUSED ? "tx" : "no-tx");
162 
163  for (int i = decoder_events->event_last_logged; i < decoder_events->cnt; i++) {
164  SCJsonBuilder *js;
165  if (tx_id != TX_ID_UNUSED) {
167  aft->json_output_ctx->eve_ctx);
168  } else {
169  js = CreateEveHeader(
171  }
172  if (unlikely(js == NULL)) {
173  return TM_ECODE_OK;
174  }
175 
176  SCJbOpenObject(js, ANOMALY_EVENT_TYPE);
177 
178  SCJbSetString(js, "app_proto", alprotoname);
179 
180  const char *event_name = NULL;
181  uint8_t event_code = decoder_events->events[i];
182  AppLayerEventType event_type;
183  int r;
184  if (is_pktlayer) {
185  r = AppLayerGetEventInfoById(event_code, &event_name, &event_type);
186  } else {
188  event_code, &event_name, &event_type);
189  }
190  if (r == 0) {
191  JB_SET_STRING(js, "type", "applayer");
192  SCJbSetString(js, "event", event_name);
193  } else {
194  JB_SET_STRING(js, "type", "unknown");
195  SCJbSetUint(js, "code", event_code);
196  }
197 
198  SCJbSetString(js, "layer", layer);
199 
200  /* anomaly */
201  SCJbClose(js);
202  OutputJsonBuilderBuffer(tv, p, p->flow, js, aft->ctx);
203  SCJbFree(js);
204 
205  /* Current implementation assumes a single owner for this value */
206  decoder_events->event_last_logged++;
207  }
208 
209  return TM_ECODE_OK;
210 }
211 
212 static int JsonAnomalyTxLogger(ThreadVars *tv, void *thread_data, const Packet *p,
213  Flow *f, void *state, void *tx, uint64_t tx_id)
214 {
215  JsonAnomalyLogThread *aft = thread_data;
217  return TM_ECODE_OK;
218  }
219 
220  AppLayerDecoderEvents *decoder_events;
221  decoder_events = AppLayerParserGetEventsByTx(f->proto, f->alproto, tx);
222  if (decoder_events && decoder_events->event_last_logged < decoder_events->cnt) {
223  SCLogDebug("state %p, tx: %p, tx_id: %"PRIu64, state, tx, tx_id);
224  AnomalyAppLayerDecoderEventJson(tv, aft, p, decoder_events, false, "proto_parser", tx_id);
225  }
226  return TM_ECODE_OK;
227 }
228 
229 static inline bool AnomalyHasParserEvents(const Packet *p)
230 {
232 }
233 
234 static inline bool AnomalyHasPacketAppLayerEvents(const Packet *p)
235 {
236  return p->app_layer_events && p->app_layer_events->cnt;
237 }
238 
239 static int AnomalyJson(ThreadVars *tv, JsonAnomalyLogThread *aft, const Packet *p)
240 {
241  int rc = TM_ECODE_OK;
242 
243  /* decode or stream */
245  if (p->events.cnt) {
246  rc = AnomalyDecodeEventJson(tv, aft, p);
247  }
248  }
249 
250  /* applayer */
252  /* app layer proto detect events */
253  if (rc == TM_ECODE_OK && AnomalyHasPacketAppLayerEvents(p)) {
254  rc = AnomalyAppLayerDecoderEventJson(
255  tv, aft, p, p->app_layer_events, true, "proto_detect", TX_ID_UNUSED);
256  }
257 
258  /* parser state events */
259  if (rc == TM_ECODE_OK && AnomalyHasParserEvents(p)) {
260  SCLogDebug("Checking for anomaly events; alproto %d", p->flow->alproto);
262  if (parser_events && (parser_events->event_last_logged < parser_events->cnt)) {
263  rc = AnomalyAppLayerDecoderEventJson(
264  tv, aft, p, parser_events, false, "parser", TX_ID_UNUSED);
265  }
266  }
267  }
268 
269  return rc;
270 }
271 
272 static int JsonAnomalyLogger(ThreadVars *tv, void *thread_data, const Packet *p)
273 {
274  JsonAnomalyLogThread *aft = thread_data;
275  return AnomalyJson(tv, aft, p);
276 }
277 
278 static bool JsonAnomalyLogCondition(ThreadVars *tv, void *thread_data, const Packet *p)
279 {
280  return p->events.cnt > 0 ||
281  (p->app_layer_events && p->app_layer_events->cnt > 0) ||
282  AnomalyHasParserEvents(p);
283 }
284 
285 static TmEcode JsonAnomalyLogThreadInit(ThreadVars *t, const void *initdata, void **data)
286 {
288  if (unlikely(aft == NULL)) {
289  return TM_ECODE_FAILED;
290  }
291 
292  if (initdata == NULL) {
293  SCLogDebug("Error getting context for EveLogAnomaly. \"initdata\" argument NULL");
294  goto error_exit;
295  }
296 
297  /** Use the Output Context (file pointer and mutex) */
298  AnomalyJsonOutputCtx *json_output_ctx = ((OutputCtx *)initdata)->data;
299 
300  aft->ctx = CreateEveThreadCtx(t, json_output_ctx->eve_ctx);
301  if (!aft->ctx) {
302  goto error_exit;
303  }
304  aft->json_output_ctx = json_output_ctx;
305 
306  *data = (void *)aft;
307  return TM_ECODE_OK;
308 
309 error_exit:
310  SCFree(aft);
311  return TM_ECODE_FAILED;
312 }
313 
314 static TmEcode JsonAnomalyLogThreadDeinit(ThreadVars *t, void *data)
315 {
317  if (aft == NULL) {
318  return TM_ECODE_OK;
319  }
320 
321  FreeEveThreadCtx(aft->ctx);
322 
323  /* clear memory */
324  memset(aft, 0, sizeof(JsonAnomalyLogThread));
325 
326  SCFree(aft);
327  return TM_ECODE_OK;
328 }
329 
330 static void JsonAnomalyLogDeInitCtxSubHelper(OutputCtx *output_ctx)
331 {
332  SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
333 
334  AnomalyJsonOutputCtx *json_output_ctx = (AnomalyJsonOutputCtx *) output_ctx->data;
335 
336  if (json_output_ctx != NULL) {
337  SCFree(json_output_ctx);
338  }
339  SCFree(output_ctx);
340 }
341 
342 static void JsonAnomalyLogDeInitCtxSub(OutputCtx *output_ctx)
343 {
344  OutputAnomalyLoggerDisable();
345 
346  JsonAnomalyLogDeInitCtxSubHelper(output_ctx);
347 }
348 
349 static void SetFlag(const SCConfNode *conf, const char *name, uint16_t flag, uint16_t *out_flags)
350 {
351  DEBUG_VALIDATE_BUG_ON(conf == NULL);
352  const char *setting = SCConfNodeLookupChildValue(conf, name);
353  if (setting != NULL) {
354  if (SCConfValIsTrue(setting)) {
355  *out_flags |= flag;
356  } else {
357  *out_flags &= ~flag;
358  }
359  }
360 }
361 
362 static void JsonAnomalyLogConf(AnomalyJsonOutputCtx *json_output_ctx, SCConfNode *conf)
363 {
364  static bool warn_no_flags = false;
365  static bool warn_no_packet = false;
366  uint16_t flags = ANOMALY_DEFAULTS;
367  if (conf != NULL) {
368  /* Check for metadata to enable/disable. */
369  SCConfNode *typeconf = SCConfNodeLookupChild(conf, "types");
370  if (typeconf != NULL) {
371  SetFlag(typeconf, "applayer", LOG_JSON_APPLAYER_TYPE, &flags);
372  SetFlag(typeconf, "stream", LOG_JSON_STREAM_TYPE, &flags);
373  SetFlag(typeconf, "decode", LOG_JSON_DECODE_TYPE, &flags);
374  }
375  SetFlag(conf, "packethdr", LOG_JSON_PACKETHDR, &flags);
376  }
377  if (((flags & (LOG_JSON_DECODE_TYPE | LOG_JSON_PACKETHDR)) == LOG_JSON_PACKETHDR) && !warn_no_packet) {
378  SCLogWarning("Anomaly logging configured to include packet headers, however decode "
379  "type logging has not been selected. Packet headers will not be logged.");
380  warn_no_packet = true;
382  }
383 
384  if (flags == 0 && !warn_no_flags) {
385  SCLogWarning("Anomaly logging has been configured; however, no logging types "
386  "have been selected. Select one or more logging types.");
387  warn_no_flags = true;
388  }
389  json_output_ctx->flags |= flags;
390 }
391 
392 static OutputInitResult JsonAnomalyLogInitCtxHelper(SCConfNode *conf, OutputCtx *parent_ctx)
393 {
394  OutputInitResult result = { NULL, false };
395  OutputJsonCtx *ajt = parent_ctx->data;
396  AnomalyJsonOutputCtx *json_output_ctx = NULL;
397 
398  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
399  if (unlikely(output_ctx == NULL))
400  return result;
401 
402  json_output_ctx = SCCalloc(1, sizeof(AnomalyJsonOutputCtx));
403  if (unlikely(json_output_ctx == NULL)) {
404  goto error;
405  }
406 
407  JsonAnomalyLogConf(json_output_ctx, conf);
408  json_output_ctx->eve_ctx = ajt;
409 
410  output_ctx->data = json_output_ctx;
411  output_ctx->DeInit = JsonAnomalyLogDeInitCtxSubHelper;
412 
413  result.ctx = output_ctx;
414  result.ok = true;
415  return result;
416 
417 error:
418  SCFree(output_ctx);
419 
420  return result;
421 }
422 
423 /**
424  * \brief Create a new LogFileCtx for "fast" output style.
425  * \param conf The configuration node for this output.
426  * \return A LogFileCtx pointer on success, NULL on failure.
427  */
428 static OutputInitResult JsonAnomalyLogInitCtxSub(SCConfNode *conf, OutputCtx *parent_ctx)
429 {
430 
431  if (!OutputAnomalyLoggerEnable()) {
432  OutputInitResult result = { NULL, false };
433  SCLogError("only one 'anomaly' logger "
434  "can be enabled");
435  return result;
436  }
437 
438  OutputInitResult result = JsonAnomalyLogInitCtxHelper(conf, parent_ctx);
439  if (result.ok) {
440  result.ctx->DeInit = JsonAnomalyLogDeInitCtxSub;
441  }
442 
443  return result;
444 }
445 
447 {
448  OutputPacketLoggerFunctions output_logger_functions = {
449  .LogFunc = JsonAnomalyLogger,
450  .ConditionFunc = JsonAnomalyLogCondition,
451  .ThreadInitFunc = JsonAnomalyLogThreadInit,
452  .ThreadDeinitFunc = JsonAnomalyLogThreadDeinit,
453  .ThreadExitPrintStatsFunc = NULL,
454  };
455 
456  OutputRegisterPacketSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME, "eve-log.anomaly",
457  JsonAnomalyLogInitCtxSub, &output_logger_functions);
458 
459  OutputRegisterTxSubModule(LOGGER_JSON_ANOMALY, "eve-log", MODULE_NAME, "eve-log.anomaly",
460  JsonAnomalyLogInitCtxHelper, ALPROTO_UNKNOWN, JsonAnomalyTxLogger,
461  JsonAnomalyLogThreadInit, JsonAnomalyLogThreadDeinit);
462 }
SCJsonBuilder
struct SCJsonBuilder SCJsonBuilder
Definition: detect-engine-helper.h:83
util-byte.h
tm-threads.h
SCConfValIsTrue
int SCConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:577
detect-engine.h
TX_ID_UNUSED
#define TX_ID_UNUSED
Definition: output-json-anomaly.c:69
LOG_JSON_PACKET_TYPE
#define LOG_JSON_PACKET_TYPE
Definition: output-json-anomaly.c:66
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
PacketEngineEvents_::events
uint8_t events[PACKET_ENGINE_EVENT_MAX]
Definition: decode.h:311
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
AppLayerParserGetEventsByTx
AppLayerDecoderEvents * AppLayerParserGetEventsByTx(uint8_t ipproto, AppProto alproto, void *tx)
Definition: app-layer-parser.c:947
name
const char * name
Definition: detect-engine-proto.c:47
FreeEveThreadCtx
void FreeEveThreadCtx(OutputJsonThreadCtx *ctx)
Definition: output-json-common.c:58
Flow_::proto
uint8_t proto
Definition: flow.h:381
CreateEveHeader
SCJsonBuilder * CreateEveHeader(const Packet *p, enum SCOutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, OutputJsonCtx *eve_ctx)
Definition: output-json.c:816
threads.h
OutputJsonCtx_
Definition: output-json.h:77
MAX_ANOMALY_LOGGERS
#define MAX_ANOMALY_LOGGERS
Definition: output-json-anomaly.c:85
Flow_
Flow data structure.
Definition: flow.h:359
AnomalyJsonOutputCtx_::flags
uint16_t flags
Definition: output-json-anomaly.c:72
AppLayerDecoderEvents_::event_last_logged
uint8_t event_last_logged
Definition: app-layer-events.h:41
CreateEveThreadCtx
OutputJsonThreadCtx * CreateEveThreadCtx(ThreadVars *t, OutputJsonCtx *ctx)
Definition: output-json-common.c:29
OutputRegisterTxSubModule
void OutputRegisterTxSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, AppProto alproto, TxLogger TxLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Definition: output.c:411
LOG_JSON_APPLAYER_TYPE
#define LOG_JSON_APPLAYER_TYPE
Definition: output-json-anomaly.c:63
util-privs.h
p
Packet * p
Definition: fuzz_dataset.c:30
OutputJsonBuilderBuffer
void OutputJsonBuilderBuffer(ThreadVars *tv, const Packet *p, Flow *f, SCJsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:1018
JsonAnomalyLogThread_::ctx
OutputJsonThreadCtx * ctx
Definition: output-json-anomaly.c:78
SCConfNodeLookupChildValue
const char * SCConfNodeLookupChildValue(const SCConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:877
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:82
ANOMALY_DEFAULTS
#define ANOMALY_DEFAULTS
Definition: output-json-anomaly.c:67
AppLayerDecoderEvents_
Data structure to store app layer decoder events.
Definition: app-layer-events.h:33
Packet_::app_layer_events
AppLayerDecoderEvents * app_layer_events
Definition: decode.h:645
Packet_::events
PacketEngineEvents events
Definition: decode.h:643
OutputCtx_::data
void * data
Definition: tm-modules.h:91
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
ANOMALY_EVENT_TYPE
#define ANOMALY_EVENT_TYPE
Definition: output-json-anomaly.c:60
OutputCtx_
Definition: tm-modules.h:88
OutputJsonThreadCtx_
Definition: output-json.h:85
Flow_::alparser
AppLayerParserState * alparser
Definition: flow.h:483
AnomalyJsonOutputCtx_::eve_ctx
OutputJsonCtx * eve_ctx
Definition: output-json-anomaly.c:73
LOG_JSON_PACKETHDR
#define LOG_JSON_PACKETHDR
Definition: output-json-anomaly.c:64
JsonAnomalyLogRegister
void JsonAnomalyLogRegister(void)
Definition: output-json-anomaly.c:446
util-debug.h
JB_SET_STRING
#define JB_SET_STRING(jb, key, val)
Definition: rust.h:36
AppLayerParserGetEventInfoById
int AppLayerParserGetEventInfoById(uint8_t ipproto, AppProto alproto, uint8_t event_id, const char **event_name, AppLayerEventType *event_type)
Definition: app-layer-parser.c:1373
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:47
DEvents
const struct DecodeEvents_ DEvents[]
Definition: decode-events.c:29
output-json.h
AppLayerEventType
AppLayerEventType
Definition: app-layer-events.h:54
util-print.h
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
OutputInitResult_::ok
bool ok
Definition: output.h:48
SCLogWarning
#define SCLogWarning(...)
Macro used to log WARNING messages.
Definition: util-debug.h:262
app-layer-parser.h
AppLayerDecoderEvents_::cnt
uint8_t cnt
Definition: app-layer-events.h:37
JsonAnomalyLogThread
struct JsonAnomalyLogThread_ JsonAnomalyLogThread
output-json-anomaly.h
MODULE_NAME
#define MODULE_NAME
Definition: output-json-anomaly.c:58
Packet_
Definition: decode.h:516
GET_PKT_LEN
#define GET_PKT_LEN(p)
Definition: decode.h:209
conf.h
TmEcode
TmEcode
Definition: tm-threads-common.h:80
util-proto-name.h
EvePacket
void EvePacket(const Packet *p, SCJsonBuilder *js, uint32_t max_length)
Jsonify a packet.
Definition: output-json.c:419
LOG_JSON_STREAM_TYPE
#define LOG_JSON_STREAM_TYPE
Definition: output-json-anomaly.c:62
DecodeEvents_::event_name
const char * event_name
Definition: decode-events.h:344
SCConfNodeLookupChild
SCConfNode * SCConfNodeLookupChild(const SCConfNode *node, const char *name)
Lookup a child configuration node by name.
Definition: conf.c:849
cnt
uint32_t cnt
Definition: tmqh-packetpool.h:7
OutputInitResult_
Definition: output.h:46
Packet_::flow
struct Flow_ * flow
Definition: decode.h:564
flags
uint8_t flags
Definition: decode-gre.h:0
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:94
JsonAnomalyLogThread_::json_output_ctx
AnomalyJsonOutputCtx * json_output_ctx
Definition: output-json-anomaly.c:77
OutputPacketLoggerFunctions_::LogFunc
PacketLogger LogFunc
Definition: output.h:87
LOG_JSON_DECODE_TYPE
#define LOG_JSON_DECODE_TYPE
Definition: output-json-anomaly.c:61
JsonAnomalyLogThread_
Definition: output-json-anomaly.c:76
CreateEveHeaderWithTxId
SCJsonBuilder * CreateEveHeaderWithTxId(const Packet *p, enum SCOutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, uint64_t tx_id, OutputJsonCtx *eve_ctx)
Definition: output-json.c:962
DECODE_EVENT_MAX
@ DECODE_EVENT_MAX
Definition: decode-events.h:335
OutputRegisterPacketSubModule
void OutputRegisterPacketSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, OutputPacketLoggerFunctions *output_logger_functions)
Register a packet output sub-module.
Definition: output.c:230
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:34
app-layer-events.h
threadvars.h
util-validate.h
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:274
SCFree
#define SCFree(p)
Definition: util-mem.h:61
util-logopenfile.h
AppLayerParserGetDecoderEvents
AppLayerDecoderEvents * AppLayerParserGetDecoderEvents(AppLayerParserState *pstate)
Definition: app-layer-parser.c:939
detect-parse.h
util-buffer.h
AppLayerGetProtoName
const char * AppLayerGetProtoName(AppProto alproto)
Given the internal protocol id, returns a string representation of the protocol.
Definition: app-layer.c:1017
AppLayerGetEventInfoById
int AppLayerGetEventInfoById(uint8_t event_id, const char **event_name, AppLayerEventType *event_type)
Definition: app-layer-events.c:66
AnomalyJsonOutputCtx_
Definition: output-json-anomaly.c:71
ALPROTO_UNKNOWN
@ ALPROTO_UNKNOWN
Definition: app-layer-protos.h:29
LOG_DIR_PACKET
@ LOG_DIR_PACKET
Definition: output-eve-bindgen.h:34
util-misc.h
flow.h
Flow_::alproto
AppProto alproto
application level protocol
Definition: flow.h:455
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
util-enum.h
SCConfNode_
Definition: conf.h:37
OutputPacketLoggerFunctions_
Definition: output.h:86
AppLayerParserHasDecoderEvents
bool AppLayerParserHasDecoderEvents(AppLayerParserState *pstate)
Definition: app-layer-parser.c:1747
AppLayerDecoderEvents_::events
uint8_t * events
Definition: app-layer-events.h:35
DEBUG_VALIDATE_BUG_ON
#define DEBUG_VALIDATE_BUG_ON(exp)
Definition: util-validate.h:109
output.h
AnomalyJsonOutputCtx
struct AnomalyJsonOutputCtx_ AnomalyJsonOutputCtx
app-layer.h
LOGGER_JSON_ANOMALY
@ LOGGER_JSON_ANOMALY
Definition: suricata-common.h:502
PacketEngineEvents_::cnt
uint8_t cnt
Definition: decode.h:310
f
Flow f
Definition: fuzz_dataset.c:32
EVENT_IS_DECODER_PACKET_ERROR
#define EVENT_IS_DECODER_PACKET_ERROR(e)
Definition: decode-events.h:338