suricata
output-json-alert.c
Go to the documentation of this file.
1 /* Copyright (C) 2013-2024 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 Tom DeCanio <td@npulsetech.com>
22  *
23  * Logs alerts in JSON format.
24  *
25  */
26 
27 #include "suricata-common.h"
28 #include "packet.h"
29 #include "detect.h"
30 #include "flow.h"
31 #include "flow-bindgen.h"
32 #include "conf.h"
33 
34 #include "stream.h"
35 #include "threadvars.h"
36 #include "util-debug.h"
37 #include "stream-tcp.h"
38 
39 #include "util-logopenfile.h"
40 #include "util-misc.h"
41 #include "util-time.h"
42 
43 #include "detect-parse.h"
44 #include "detect-engine.h"
45 #include "detect-metadata.h"
46 #include "app-layer-parser.h"
47 #include "app-layer-htp-xff.h"
48 #include "app-layer-ftp.h"
49 #include "app-layer-frames.h"
50 #include "log-pcap.h"
51 
52 #include "output.h"
53 #include "output-json.h"
54 #include "output-json-alert.h"
55 #include "output-json-http.h"
56 #include "rust.h"
57 #include "output-json-smtp.h"
59 #include "output-json-nfs.h"
60 #include "output-json-smb.h"
61 #include "output-json-flow.h"
62 #include "output-json-ike.h"
63 #include "output-json-frame.h"
64 
65 #include "util-print.h"
66 #include "util-optimize.h"
67 #include "util-buffer.h"
68 #include "util-reference-config.h"
69 #include "util-validate.h"
70 
71 #include "action-globals.h"
72 
73 #define MODULE_NAME "JsonAlertLog"
74 
75 #define LOG_JSON_PAYLOAD BIT_U16(0)
76 #define LOG_JSON_PACKET BIT_U16(1)
77 #define LOG_JSON_PAYLOAD_BASE64 BIT_U16(2)
78 #define LOG_JSON_TAGGED_PACKETS BIT_U16(3)
79 #define LOG_JSON_APP_LAYER BIT_U16(4)
80 #define LOG_JSON_FLOW BIT_U16(5)
81 #define LOG_JSON_HTTP_BODY BIT_U16(6)
82 #define LOG_JSON_HTTP_BODY_BASE64 BIT_U16(7)
83 #define LOG_JSON_RULE_METADATA BIT_U16(8)
84 #define LOG_JSON_RULE BIT_U16(9)
85 #define LOG_JSON_VERDICT BIT_U16(10)
86 #define LOG_JSON_WEBSOCKET_PAYLOAD BIT_U16(11)
87 #define LOG_JSON_WEBSOCKET_PAYLOAD_BASE64 BIT_U16(12)
88 #define LOG_JSON_PAYLOAD_LENGTH BIT_U16(13)
89 #define LOG_JSON_REFERENCE BIT_U16(14)
90 
91 #define METADATA_DEFAULTS ( LOG_JSON_FLOW | \
92  LOG_JSON_APP_LAYER | \
93  LOG_JSON_RULE_METADATA)
94 
95 #define JSON_BODY_LOGGING \
96  (LOG_JSON_HTTP_BODY | LOG_JSON_HTTP_BODY_BASE64 | LOG_JSON_WEBSOCKET_PAYLOAD | \
97  LOG_JSON_WEBSOCKET_PAYLOAD_BASE64)
98 
99 #define JSON_STREAM_BUFFER_SIZE 4096
100 
101 typedef struct AlertJsonOutputCtx_ {
103  uint16_t flags;
109 
110 typedef struct JsonAlertLogThread_ {
115 
116 static void AlertJsonSourceTarget(
117  const Packet *p, const PacketAlert *pa, SCJsonBuilder *js, JsonAddrInfo *addr)
118 {
119  SCJbOpenObject(js, "source");
120  if (pa->s->flags & SIG_FLAG_DEST_IS_TARGET) {
121  SCJbSetString(js, "ip", addr->src_ip);
122  switch (p->proto) {
123  case IPPROTO_ICMP:
124  case IPPROTO_ICMPV6:
125  break;
126  case IPPROTO_UDP:
127  case IPPROTO_TCP:
128  case IPPROTO_SCTP:
129  SCJbSetUint(js, "port", addr->sp);
130  break;
131  }
132  } else if (pa->s->flags & SIG_FLAG_SRC_IS_TARGET) {
133  SCJbSetString(js, "ip", addr->dst_ip);
134  switch (p->proto) {
135  case IPPROTO_ICMP:
136  case IPPROTO_ICMPV6:
137  break;
138  case IPPROTO_UDP:
139  case IPPROTO_TCP:
140  case IPPROTO_SCTP:
141  SCJbSetUint(js, "port", addr->dp);
142  break;
143  }
144  }
145  SCJbClose(js);
146 
147  SCJbOpenObject(js, "target");
148  if (pa->s->flags & SIG_FLAG_DEST_IS_TARGET) {
149  SCJbSetString(js, "ip", addr->dst_ip);
150  switch (p->proto) {
151  case IPPROTO_ICMP:
152  case IPPROTO_ICMPV6:
153  break;
154  case IPPROTO_UDP:
155  case IPPROTO_TCP:
156  case IPPROTO_SCTP:
157  SCJbSetUint(js, "port", addr->dp);
158  break;
159  }
160  } else if (pa->s->flags & SIG_FLAG_SRC_IS_TARGET) {
161  SCJbSetString(js, "ip", addr->src_ip);
162  switch (p->proto) {
163  case IPPROTO_ICMP:
164  case IPPROTO_ICMPV6:
165  break;
166  case IPPROTO_UDP:
167  case IPPROTO_TCP:
168  case IPPROTO_SCTP:
169  SCJbSetUint(js, "port", addr->sp);
170  break;
171  }
172  }
173  SCJbClose(js);
174 }
175 
176 static void AlertJsonReference(const PacketAlert *pa, SCJsonBuilder *jb)
177 {
178  if (!pa->s->references) {
179  return;
180  }
181 
182  const DetectReference *kv = pa->s->references;
183  SCJbOpenArray(jb, "references");
184  while (kv) {
185  /* Note that the key and reference sizes have been bound
186  * checked during parsing
187  * add +2 to safisfy gcc 15 + -Wformat-truncation=2
188  */
189  const size_t size_needed = kv->key_len + kv->reference_len + 3;
191  char kv_store[size_needed];
192  snprintf(kv_store, size_needed, "%s%s", kv->key, kv->reference);
193  SCJbAppendString(jb, kv_store);
194  kv = kv->next;
195  }
196  SCJbClose(jb);
197 }
198 
199 static void AlertJsonMetadata(const PacketAlert *pa, SCJsonBuilder *js)
200 {
201  if (pa->s->metadata && pa->s->metadata->json_str) {
202  SCJbSetFormatted(js, pa->s->metadata->json_str);
203  }
204 }
205 
206 void AlertJsonHeader(const Packet *p, const PacketAlert *pa, SCJsonBuilder *js, uint16_t flags,
207  JsonAddrInfo *addr, char *xff_buffer)
208 {
209  const char *action = "allowed";
210  /* use packet action if rate_filter modified the action */
213  action = "blocked";
214  }
215  } else {
216  if (pa->action & ACTION_REJECT_ANY) {
217  action = "blocked";
218  } else if ((pa->action & ACTION_DROP) && EngineModeIsIPS()) {
219  action = "blocked";
220  }
221  }
222 
223  /* Add tx_id to root element for correlation with other events. */
224  /* json_object_del(js, "tx_id"); */
225  if (pa->flags & PACKET_ALERT_FLAG_TX) {
226  SCJbSetUint(js, "tx_id", pa->tx_id);
227  }
229  SCJbSetBool(js, "tx_guessed", true);
230  }
231 
232  SCJbOpenObject(js, "alert");
233 
234  SCJbSetString(js, "action", action);
235  if (EngineModeIsFirewall()) {
236  SCJbSetString(js, "engine", (pa->s->flags & SIG_FLAG_FIREWALL) ? "fw" : "td");
237  }
238  SCJbSetUint(js, "gid", pa->s->gid);
239  SCJbSetUint(js, "signature_id", pa->s->id);
240  SCJbSetUint(js, "rev", pa->s->rev);
241  /* TODO: SCJsonBuilder should handle unprintable characters like
242  * SCJsonString. */
243  SCJbSetString(js, "signature", pa->s->msg ? pa->s->msg : "");
244  SCJbSetString(js, "category", pa->s->class_msg ? pa->s->class_msg : "");
245  SCJbSetUint(js, "severity", pa->s->prio);
246 
247  if (p->tenant_id > 0) {
248  SCJbSetUint(js, "tenant_id", p->tenant_id);
249  }
250 
251  if (addr && pa->s->flags & SIG_FLAG_HAS_TARGET) {
252  AlertJsonSourceTarget(p, pa, js, addr);
253  }
254 
255  if ((flags & LOG_JSON_REFERENCE)) {
256  AlertJsonReference(pa, js);
257  }
258 
260  AlertJsonMetadata(pa, js);
261  }
262 
263  if (pa->json_info != NULL) {
264  SCJbOpenObject(js, "context");
265  const struct PacketContextData *json_info = pa->json_info;
266  while (json_info) {
267  SCLogDebug("JSON string '{%s}'", json_info->json_string);
268  /* The string is valid json as it is validated by JANSSON
269  during parsing and included later via a format string */
270  SCJbSetFormatted(js, json_info->json_string);
271  json_info = json_info->next;
272  }
273  SCJbClose(js);
274  }
275  if (flags & LOG_JSON_RULE) {
276  SCJbSetString(js, "rule", pa->s->sig_str);
277  }
278  if (xff_buffer && xff_buffer[0]) {
279  SCJbSetString(js, "xff", xff_buffer);
280  }
281 
282  SCJbClose(js);
283 }
284 
285 static void AlertJsonTunnel(const Packet *p, SCJsonBuilder *js, OutputJsonCommonSettings *cfg)
286 {
287  if (p->root == NULL) {
288  return;
289  }
290 
291  SCJbOpenObject(js, "tunnel");
292 
293  enum PktSrcEnum pkt_src;
295  JsonAddrInfoInit(p->root, 0, &addr, cfg);
296  pkt_src = p->root->pkt_src;
297 
298  SCJbSetString(js, "src_ip", addr.src_ip);
299  SCJbSetUint(js, "src_port", addr.sp);
300  SCJbSetString(js, "dest_ip", addr.dst_ip);
301  SCJbSetUint(js, "dest_port", addr.dp);
302  SCJbSetString(js, "proto", addr.proto);
303 
304  SCJbSetUint(js, "depth", p->recursion_level);
305  uint64_t pcap_cnt = PcapPacketCntGet(p->root);
306  if (pcap_cnt != 0) {
307  SCJbSetUint(js, "pcap_cnt", pcap_cnt);
308  }
309  SCJbSetString(js, "pkt_src", PktSrcToString(pkt_src));
310  SCJbClose(js);
311 }
312 
313 static void AlertAddPayload(AlertJsonOutputCtx *json_output_ctx, SCJsonBuilder *js, const Packet *p)
314 {
315  if (json_output_ctx->flags & LOG_JSON_PAYLOAD_BASE64) {
316  SCJbSetBase64(js, "payload", p->payload, p->payload_len);
317  }
318  if (json_output_ctx->flags & LOG_JSON_PAYLOAD_LENGTH) {
319  SCJbSetUint(js, "payload_length", p->payload_len);
320  }
321 
322  if (json_output_ctx->flags & LOG_JSON_PAYLOAD) {
323  SCJbSetPrintAsciiString(js, "payload_printable", p->payload, p->payload_len);
324  }
325 }
326 
327 static void AlertAddAppLayerStates(const Packet *p, const AppProto alproto, const uint8_t sub_state,
328  void *tx, SCJsonBuilder *jb)
329 {
330  const int ts = AppLayerParserGetStateProgress(p->flow->proto, alproto, tx, STREAM_TOSERVER);
331  const int tc = AppLayerParserGetStateProgress(p->flow->proto, alproto, tx, STREAM_TOCLIENT);
332  if (sub_state == 0) {
333  SCJbSetString(jb, "ts_progress",
334  AppLayerParserGetStateNameById(p->flow->proto, alproto, ts, STREAM_TOSERVER));
335  SCJbSetString(jb, "tc_progress",
336  AppLayerParserGetStateNameById(p->flow->proto, alproto, tc, STREAM_TOCLIENT));
337  } else {
338  const char *sname = AppLayerParserGetSubStateName(alproto, sub_state);
339  if (sname != NULL) {
340  SCJbSetString(jb, "sub_state", sname);
341  }
342  SCJbSetString(jb, "ts_progress",
344  alproto, sub_state, (uint8_t)ts, STREAM_TOSERVER));
345  SCJbSetString(jb, "tc_progress",
347  alproto, sub_state, (uint8_t)tc, STREAM_TOCLIENT));
348  }
349 }
350 
351 static void AlertAddAppLayer(const Packet *p, SCJsonBuilder *jb, const uint64_t tx_id,
352  const uint8_t sub_state, const uint16_t option_flags)
353 {
356  void *state = FlowGetAppState(p->flow);
357  void *tx = NULL;
358  if (state) {
359  tx = AppLayerParserGetTx(p->flow->proto, proto, state, tx_id);
360  }
361  if (tx == NULL)
362  return;
363 
364  AlertAddAppLayerStates(p, proto, sub_state, tx, jb);
365 
366  SCJsonBuilderMark mark = { 0, 0, 0 };
367  if (al && al->LogTx) {
368  SCJbGetMark(jb, &mark);
369  switch (proto) {
370  // first check some protocols need special options for alerts logging
371  case ALPROTO_WEBSOCKET:
372  if (option_flags &
374  const bool pp = (option_flags & LOG_JSON_WEBSOCKET_PAYLOAD) != 0;
375  const bool pb64 = (option_flags & LOG_JSON_WEBSOCKET_PAYLOAD_BASE64) != 0;
376  if (!SCWebSocketLogDetails(tx, jb, pp, pb64)) {
377  SCJbRestoreMark(jb, &mark);
378  }
379  // nothing more to log or do
380  return;
381  }
382  }
383  if (!al->LogTx(tx, jb)) {
384  SCJbRestoreMark(jb, &mark);
385  }
386  return;
387  }
388 
389  switch (proto) {
390  case ALPROTO_HTTP1:
391  // TODO: Could result in an empty http object being logged.
392  SCJbOpenObject(jb, "http");
393  if (EveHttpAddMetadata(p->flow, tx_id, jb)) {
394  if (option_flags & LOG_JSON_HTTP_BODY) {
395  EveHttpLogJSONBodyPrintable(jb, p->flow, tx_id);
396  }
397  if (option_flags & LOG_JSON_HTTP_BODY_BASE64) {
398  EveHttpLogJSONBodyBase64(jb, p->flow, tx_id);
399  }
400  }
401  SCJbClose(jb);
402  break;
403  case ALPROTO_SMTP:
404  SCJbGetMark(jb, &mark);
405  SCJbOpenObject(jb, "smtp");
406  if (EveSMTPAddMetadata(p->flow, tx_id, jb)) {
407  SCJbClose(jb);
408  } else {
409  SCJbRestoreMark(jb, &mark);
410  }
411  SCJbGetMark(jb, &mark);
412  SCJbOpenObject(jb, "email");
413  if (EveEmailAddMetadata(p->flow, tx_id, jb)) {
414  SCJbClose(jb);
415  } else {
416  SCJbRestoreMark(jb, &mark);
417  }
418  break;
419  case ALPROTO_NFS:
420  /* rpc */
421  SCJbGetMark(jb, &mark);
422  SCJbOpenObject(jb, "rpc");
423  if (EveNFSAddMetadataRPC(p->flow, tx_id, jb)) {
424  SCJbClose(jb);
425  } else {
426  SCJbRestoreMark(jb, &mark);
427  }
428  /* nfs */
429  SCJbGetMark(jb, &mark);
430  SCJbOpenObject(jb, "nfs");
431  if (EveNFSAddMetadata(p->flow, tx_id, jb)) {
432  SCJbClose(jb);
433  } else {
434  SCJbRestoreMark(jb, &mark);
435  }
436  break;
437  case ALPROTO_SMB:
438  SCJbGetMark(jb, &mark);
439  SCJbOpenObject(jb, "smb");
440  if (EveSMBAddMetadata(p->flow, tx_id, jb)) {
441  SCJbClose(jb);
442  } else {
443  SCJbRestoreMark(jb, &mark);
444  }
445  break;
446  case ALPROTO_IKE:
447  SCJbGetMark(jb, &mark);
448  if (!EveIKEAddMetadata(p->flow, tx_id, jb)) {
449  SCJbRestoreMark(jb, &mark);
450  }
451  break;
452  case ALPROTO_DCERPC:
453  SCJbGetMark(jb, &mark);
454  SCJbOpenObject(jb, "dcerpc");
455  if (p->proto == IPPROTO_TCP) {
456  if (!SCDcerpcLogJsonRecordTcp(state, tx, jb)) {
457  SCJbRestoreMark(jb, &mark);
458  }
459  } else {
460  if (!SCDcerpcLogJsonRecordUdp(state, tx, jb)) {
461  SCJbRestoreMark(jb, &mark);
462  }
463  }
464  SCJbClose(jb);
465  break;
466  default:
467  break;
468  }
469 }
470 
471 static void AlertAddFiles(const Packet *p, SCJsonBuilder *jb, const uint64_t tx_id)
472 {
473  const uint8_t direction =
474  (p->flowflags & FLOW_PKT_TOSERVER) ? STREAM_TOSERVER : STREAM_TOCLIENT;
475  FileContainer *ffc = NULL;
476  if (p->flow->alstate != NULL) {
477  void *tx = AppLayerParserGetTx(p->flow->proto, p->flow->alproto, p->flow->alstate, tx_id);
478  if (tx) {
479  AppLayerGetFileState files = AppLayerParserGetTxFiles(p->flow, tx, direction);
480  ffc = files.fc;
481  }
482  }
483  if (ffc != NULL) {
484  File *file = ffc->head;
485  bool isopen = false;
486  while (file) {
487  if (!isopen) {
488  isopen = true;
489  SCJbOpenArray(jb, "files");
490  }
491  SCJbStartObject(jb);
492  EveFileInfo(jb, file, tx_id, file->flags);
493  SCJbClose(jb);
494  file = file->next;
495  }
496  if (isopen) {
497  SCJbClose(jb);
498  }
499  }
500 }
501 
502 static void AlertAddFrame(
503  const Packet *p, const int64_t frame_id, SCJsonBuilder *jb, MemBuffer *buffer)
504 {
505  if (p->flow == NULL || (p->proto == IPPROTO_TCP && p->flow->protoctx == NULL))
506  return;
507 
508  FramesContainer *frames_container = AppLayerFramesGetContainer(p->flow);
509  if (frames_container == NULL)
510  return;
511 
512  Frames *frames = NULL;
513  TcpStream *stream = NULL;
514  if (p->proto == IPPROTO_TCP) {
515  TcpSession *ssn = p->flow->protoctx;
516  if (PKT_IS_TOSERVER(p)) {
517  stream = &ssn->client;
518  frames = &frames_container->toserver;
519  } else {
520  stream = &ssn->server;
521  frames = &frames_container->toclient;
522  }
523  Frame *frame = FrameGetById(frames, frame_id);
524  if (frame != NULL) {
525  FrameJsonLogOneFrame(IPPROTO_TCP, frame, p->flow, stream, p, jb, buffer);
526  }
527  } else if (p->proto == IPPROTO_UDP) {
528  if (PKT_IS_TOSERVER(p)) {
529  frames = &frames_container->toserver;
530  } else {
531  frames = &frames_container->toclient;
532  }
533  Frame *frame = FrameGetById(frames, frame_id);
534  if (frame != NULL) {
535  FrameJsonLogOneFrame(IPPROTO_UDP, frame, p->flow, NULL, p, jb, buffer);
536  }
537  }
538 }
539 
540 /**
541  * \brief Build verdict object
542  *
543  * \param p Pointer to Packet current being logged
544  * \param alert_action action bitfield from the alert: only used for ACTION_PASS
545  */
546 void EveAddVerdict(SCJsonBuilder *jb, const Packet *p, const uint8_t alert_action)
547 {
548  SCJbOpenObject(jb, "verdict");
549 
550  const uint8_t packet_action = PacketGetAction(p);
551  SCLogDebug("%" PRIu64 ": packet_action %02x alert_action %02x", PcapPacketCntGet(p),
552  packet_action, alert_action);
553  /* add verdict info */
554  if (packet_action & ACTION_REJECT_ANY) {
555  // check rule to define type of reject packet sent
556  if (EngineModeIsIPS()) {
557  JB_SET_STRING(jb, "action", "drop");
558  } else {
559  JB_SET_STRING(jb, "action", "alert");
560  }
561  if (packet_action & ACTION_REJECT) {
562  JB_SET_STRING(jb, "reject_target", "to_client");
563  } else if (packet_action & ACTION_REJECT_DST) {
564  JB_SET_STRING(jb, "reject_target", "to_server");
565  } else if (packet_action & ACTION_REJECT_BOTH) {
566  JB_SET_STRING(jb, "reject_target", "both");
567  }
568  SCJbOpenArray(jb, "reject");
569  switch (p->proto) {
570  case IPPROTO_UDP:
571  case IPPROTO_ICMP:
572  case IPPROTO_ICMPV6:
573  SCJbAppendString(jb, "icmp-prohib");
574  break;
575  case IPPROTO_TCP:
576  SCJbAppendString(jb, "tcp-reset");
577  break;
578  }
579  SCJbClose(jb);
580 
581  } else if ((packet_action & ACTION_DROP) && EngineModeIsIPS()) {
582  JB_SET_STRING(jb, "action", "drop");
583  } else if (packet_action & ACTION_ACCEPT) {
584  JB_SET_STRING(jb, "action", "accept");
585  } else if (alert_action & ACTION_PASS) {
586  JB_SET_STRING(jb, "action", "pass");
587  } else {
588  // TODO make sure we don't have a situation where this wouldn't work
589  JB_SET_STRING(jb, "action", "alert");
590  }
591 
592  /* Close verdict */
593  SCJbClose(jb);
594 }
595 
598  uint64_t last_re;
599 };
600 
601 static int AlertJsonStreamDataCallback(
602  void *cb_data, const uint8_t *input, const uint32_t input_len, const uint64_t input_offset)
603 {
604  struct AlertJsonStreamDataCallbackData *cbd = cb_data;
605  if (input_offset > cbd->last_re) {
607  cbd->payload, "[%" PRIu64 " bytes missing]", input_offset - cbd->last_re);
608  }
609 
610  int done = 0;
611  uint32_t written = MemBufferWriteRaw(cbd->payload, input, input_len);
612  if (written < input_len)
613  done = 1;
614  cbd->last_re = input_offset + input_len;
615  return done;
616 }
617 
618 /** \internal
619  * \brief try to log stream data into payload/payload_printable
620  * \retval true stream data logged
621  * \retval false stream data not logged
622  */
623 static bool AlertJsonStreamData(const AlertJsonOutputCtx *json_output_ctx, JsonAlertLogThread *aft,
624  Flow *f, const Packet *p, SCJsonBuilder *jb)
625 {
626  TcpSession *ssn = f->protoctx;
627  TcpStream *stream = (PKT_IS_TOSERVER(p)) ? &ssn->client : &ssn->server;
628 
629  MemBufferReset(aft->payload_buffer);
631  .last_re = STREAM_BASE_OFFSET(stream) };
632  uint64_t unused = 0;
633  StreamReassembleLog(ssn, stream, AlertJsonStreamDataCallback, &cbd, STREAM_BASE_OFFSET(stream),
634  &unused, false);
635  if (cbd.payload->offset) {
636  if (json_output_ctx->flags & LOG_JSON_PAYLOAD_BASE64) {
637  SCJbSetBase64(jb, "payload", cbd.payload->buffer, cbd.payload->offset);
638  }
639  if (json_output_ctx->flags & LOG_JSON_PAYLOAD_LENGTH) {
640  SCJbSetUint(jb, "payload_length", cbd.payload->offset);
641  }
642 
643  if (json_output_ctx->flags & LOG_JSON_PAYLOAD) {
644  SCJbSetPrintAsciiString(
645  jb, "payload_printable", cbd.payload->buffer, cbd.payload->offset);
646  }
647  return true;
648  }
649  return false;
650 }
651 
652 static void AlertJsonAddFirewall(SCJsonBuilder *jb, const Signature *s)
653 {
654  struct DetectFirewallPolicy pol = { .action = s->action, .action_scope = s->action_scope };
655 
656  SCJbOpenObject(jb, "firewall");
657  const char *hook = NULL;
658  char hook_string[256];
659  switch (s->detect_table) {
661  if (s->flags & SIG_FLAG_TOSERVER) {
663  IPPROTO_TCP, s->alproto, s->app_progress_hook, STREAM_TOSERVER);
664  } else {
666  IPPROTO_TCP, s->alproto, s->app_progress_hook, STREAM_TOCLIENT);
667  }
668  if (hook) {
669  snprintf(hook_string, sizeof(hook_string), "%s:%s", AppProtoToString(s->alproto),
670  hook);
671  hook = hook_string;
672  }
673  break;
675  hook = "packet:filter";
676  break;
678  hook = "packet:pre_flow";
679  break;
681  hook = "packet:pre_stream";
682  break;
683  }
684  if (hook) {
685  SCJbSetString(jb, "hook", hook);
686  }
687  char policy_string[64] = "";
688  DetectFirewallPolicyToString(&pol, policy_string, sizeof(policy_string));
689  if (strlen(policy_string) > 0) {
690  SCJbSetString(jb, "policy", policy_string);
691  }
692  SCJbClose(jb);
693 }
694 
695 static int AlertJson(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
696 {
697  AlertJsonOutputCtx *json_output_ctx = aft->json_output_ctx;
698 
699  if (p->alerts.cnt == 0 && !(p->flags & PKT_HAS_TAG))
700  return TM_ECODE_OK;
701 
702  const uint8_t final_action = p->alerts.cnt > 0 ? p->alerts.alerts[p->alerts.cnt - 1].action : 0;
703  for (int i = 0; i < p->alerts.cnt; i++) {
704  const PacketAlert *pa = &p->alerts.alerts[i];
705  if (unlikely(pa->s == NULL || (pa->action & ACTION_ALERT) == 0)) {
706  continue;
707  }
708 
709  /* First initialize the address info (5-tuple). */
711  JsonAddrInfoInit(p, LOG_DIR_PACKET, &addr, &json_output_ctx->eve_ctx->cfg);
712 
713  /* Check for XFF, overwriting address info if needed. */
714  HttpXFFCfg *xff_cfg = json_output_ctx->xff_cfg != NULL ? json_output_ctx->xff_cfg
715  : json_output_ctx->parent_xff_cfg;
716  int have_xff_ip = 0;
717  char xff_buffer[XFF_MAXLEN];
718  xff_buffer[0] = 0;
719  if ((xff_cfg != NULL) && !(xff_cfg->flags & XFF_DISABLED) && p->flow != NULL) {
721  if (pa->flags & PACKET_ALERT_FLAG_TX) {
722  have_xff_ip = HttpXFFGetIPFromTx(p->flow, pa->tx_id, xff_cfg,
723  xff_buffer, XFF_MAXLEN);
724  } else {
725  have_xff_ip = HttpXFFGetIP(p->flow, xff_cfg, xff_buffer,
726  XFF_MAXLEN);
727  }
728  }
729 
730  if (have_xff_ip && xff_cfg->flags & XFF_OVERWRITE) {
731  if (p->flowflags & FLOW_PKT_TOCLIENT) {
732  strlcpy(addr.dst_ip, xff_buffer, JSON_ADDR_LEN);
733  } else {
734  strlcpy(addr.src_ip, xff_buffer, JSON_ADDR_LEN);
735  }
736  /* Clear have_xff_ip so the xff field does not get
737  * logged below. */
738  have_xff_ip = false;
739  }
740  if (have_xff_ip && !(xff_cfg->flags & XFF_EXTRADATA)) {
741  // reset xff_buffer so as not to log it
742  xff_buffer[0] = 0;
743  }
744  }
745 
746  SCJsonBuilder *jb =
747  CreateEveHeader(p, LOG_DIR_PACKET, "alert", &addr, json_output_ctx->eve_ctx);
748  if (unlikely(jb == NULL))
749  return TM_ECODE_OK;
750 
751 
752  /* alert */
753  AlertJsonHeader(p, pa, jb, json_output_ctx->flags, &addr, xff_buffer);
754 
755  if (PacketIsTunnel(p)) {
756  AlertJsonTunnel(p, jb, &json_output_ctx->eve_ctx->cfg);
757  }
758 
759  if (pa->s->flags & SIG_FLAG_FIREWALL) {
760  AlertJsonAddFirewall(jb, pa->s);
761  }
762 
763  if (p->flow != NULL) {
764  if (pa->flags & PACKET_ALERT_FLAG_TX) {
765  if (json_output_ctx->flags & LOG_JSON_APP_LAYER) {
766  AlertAddAppLayer(p, jb, pa->tx_id, pa->sub_state, json_output_ctx->flags);
767  }
768  /* including fileinfo data is configured by the metadata setting */
769  if (json_output_ctx->flags & LOG_JSON_RULE_METADATA) {
770  AlertAddFiles(p, jb, pa->tx_id);
771  }
772  }
773 
774  EveAddAppProto(p->flow, jb);
775 
776  if (p->flowflags & FLOW_PKT_TOSERVER) {
777  SCJbSetString(jb, "direction", "to_server");
778  } else {
779  SCJbSetString(jb, "direction", "to_client");
780  }
781 
782  if (json_output_ctx->flags & LOG_JSON_FLOW) {
783  SCJbOpenObject(jb, "flow");
784  EveAddFlow(p->flow, jb);
785  if (p->flowflags & FLOW_PKT_TOCLIENT) {
786  SCJbSetString(jb, "src_ip", addr.dst_ip);
787  SCJbSetString(jb, "dest_ip", addr.src_ip);
788  if (addr.sp > 0) {
789  SCJbSetUint(jb, "src_port", addr.dp);
790  SCJbSetUint(jb, "dest_port", addr.sp);
791  }
792  } else {
793  SCJbSetString(jb, "src_ip", addr.src_ip);
794  SCJbSetString(jb, "dest_ip", addr.dst_ip);
795  if (addr.sp > 0) {
796  SCJbSetUint(jb, "src_port", addr.sp);
797  SCJbSetUint(jb, "dest_port", addr.dp);
798  }
799  }
800  SCJbClose(jb);
801  }
802  }
803 
804  /* payload */
805  if (json_output_ctx->flags &
807  int stream = (p->proto == IPPROTO_TCP) ?
809  1 : 0) : 0;
810  // should be impossible, as stream implies flow
811  DEBUG_VALIDATE_BUG_ON(stream && p->flow == NULL);
812 
813  /* Is this a stream? If so, pack part of it into the payload field */
814  if (stream && p->flow != NULL) {
815  const bool stream_data_logged =
816  AlertJsonStreamData(json_output_ctx, aft, p->flow, p, jb);
817  if (!stream_data_logged && p->payload_len) {
818  /* Fallback on packet payload */
819  AlertAddPayload(json_output_ctx, jb, p);
820  }
821  } else {
822  /* This is a single packet and not a stream */
823  AlertAddPayload(json_output_ctx, jb, p);
824  }
825 
826  SCJbSetUint(jb, "stream", stream);
827  }
828 
829  if (pa->flags & PACKET_ALERT_FLAG_FRAME) {
830  AlertAddFrame(p, pa->frame_id, jb, aft->payload_buffer);
831  }
832 
833  /* base64-encoded full packet */
834  if (json_output_ctx->flags & LOG_JSON_PACKET) {
835  EvePacket(p, jb, 0);
836  }
837 
839  if (pcap_filename != NULL) {
840  SCJbSetString(jb, "capture_file", pcap_filename);
841  }
842 
843  if (json_output_ctx->flags & LOG_JSON_VERDICT) {
844  EveAddVerdict(jb, p, final_action & ACTION_PASS);
845  }
846 
847  OutputJsonBuilderBuffer(tv, p, p->flow, jb, aft->ctx);
848  SCJbFree(jb);
849  }
850 
851  if ((p->flags & PKT_HAS_TAG) && (json_output_ctx->flags &
853  SCJsonBuilder *packetjs =
854  CreateEveHeader(p, LOG_DIR_PACKET, "packet", NULL, json_output_ctx->eve_ctx);
855  if (unlikely(packetjs != NULL)) {
856  EvePacket(p, packetjs, 0);
857  OutputJsonBuilderBuffer(tv, p, p->flow, packetjs, aft->ctx);
858  SCJbFree(packetjs);
859  }
860  }
861 
862  return TM_ECODE_OK;
863 }
864 
865 static int AlertJsonDecoderEvent(ThreadVars *tv, JsonAlertLogThread *aft, const Packet *p)
866 {
867  AlertJsonOutputCtx *json_output_ctx = aft->json_output_ctx;
868 
869  if (p->alerts.cnt == 0)
870  return TM_ECODE_OK;
871 
872  const uint8_t final_action = p->alerts.alerts[p->alerts.cnt - 1].action;
873  for (int i = 0; i < p->alerts.cnt; i++) {
874  const PacketAlert *pa = &p->alerts.alerts[i];
875  if (unlikely(pa->s == NULL || (pa->action & ACTION_ALERT) == 0)) {
876  continue;
877  }
878 
879  SCJsonBuilder *jb =
880  CreateEveHeader(p, LOG_DIR_PACKET, "alert", NULL, json_output_ctx->eve_ctx);
881  if (unlikely(jb == NULL))
882  return TM_ECODE_OK;
883 
884  AlertJsonHeader(p, pa, jb, json_output_ctx->flags, NULL, NULL);
885 
886  if (PacketIsTunnel(p)) {
887  AlertJsonTunnel(p, jb, &json_output_ctx->eve_ctx->cfg);
888  }
889 
890  /* base64-encoded full packet */
891  if (json_output_ctx->flags & LOG_JSON_PACKET) {
892  EvePacket(p, jb, 0);
893  }
894 
896  if (pcap_filename != NULL) {
897  SCJbSetString(jb, "capture_file", pcap_filename);
898  }
899 
900  if (json_output_ctx->flags & LOG_JSON_VERDICT) {
901  EveAddVerdict(jb, p, final_action & ACTION_PASS);
902  }
903 
904  OutputJsonBuilderBuffer(tv, p, p->flow, jb, aft->ctx);
905  SCJbFree(jb);
906  }
907 
908  return TM_ECODE_OK;
909 }
910 
911 static int JsonAlertLogger(ThreadVars *tv, void *thread_data, const Packet *p)
912 {
913  JsonAlertLogThread *aft = thread_data;
914 
915  if (PacketIsIPv4(p) || PacketIsIPv6(p)) {
916  return AlertJson(tv, aft, p);
917  } else if (p->alerts.cnt > 0) {
918  return AlertJsonDecoderEvent(tv, aft, p);
919  }
920  return 0;
921 }
922 
923 static bool JsonAlertLogCondition(ThreadVars *tv, void *thread_data, const Packet *p)
924 {
925  return (p->alerts.cnt || (p->flags & PKT_HAS_TAG));
926 }
927 
928 static TmEcode JsonAlertLogThreadInit(ThreadVars *t, const void *initdata, void **data)
929 {
931  if (unlikely(aft == NULL))
932  return TM_ECODE_FAILED;
933 
934  if (initdata == NULL)
935  {
936  SCLogDebug("Error getting context for EveLogAlert. \"initdata\" argument NULL");
937  goto error_exit;
938  }
939 
940  /** Use the Output Context (file pointer and mutex) */
941  AlertJsonOutputCtx *json_output_ctx = ((OutputCtx *)initdata)->data;
942 
943  aft->payload_buffer = MemBufferCreateNew(json_output_ctx->payload_buffer_size);
944  if (aft->payload_buffer == NULL) {
945  goto error_exit;
946  }
947  aft->ctx = CreateEveThreadCtx(t, json_output_ctx->eve_ctx);
948  if (!aft->ctx) {
949  goto error_exit;
950  }
951 
952  aft->json_output_ctx = json_output_ctx;
953 
954  *data = (void *)aft;
955  return TM_ECODE_OK;
956 
957 error_exit:
958  if (aft->payload_buffer != NULL) {
960  }
961  SCFree(aft);
962  return TM_ECODE_FAILED;
963 }
964 
965 static TmEcode JsonAlertLogThreadDeinit(ThreadVars *t, void *data)
966 {
967  JsonAlertLogThread *aft = (JsonAlertLogThread *)data;
968  if (aft == NULL) {
969  return TM_ECODE_OK;
970  }
971 
973  FreeEveThreadCtx(aft->ctx);
974 
975  /* clear memory */
976  memset(aft, 0, sizeof(JsonAlertLogThread));
977 
978  SCFree(aft);
979  return TM_ECODE_OK;
980 }
981 
982 static void JsonAlertLogDeInitCtxSub(OutputCtx *output_ctx)
983 {
984  SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
985 
986  AlertJsonOutputCtx *json_output_ctx = (AlertJsonOutputCtx *) output_ctx->data;
987 
988  if (json_output_ctx != NULL) {
989  HttpXFFCfg *xff_cfg = json_output_ctx->xff_cfg;
990  if (xff_cfg != NULL) {
991  SCFree(xff_cfg);
992  }
993  SCFree(json_output_ctx);
994  }
995  SCFree(output_ctx);
996 }
997 
998 static void SetFlag(const SCConfNode *conf, const char *name, uint16_t flag, uint16_t *out_flags)
999 {
1000  DEBUG_VALIDATE_BUG_ON(conf == NULL);
1001  const char *setting = SCConfNodeLookupChildValue(conf, name);
1002  if (setting != NULL) {
1003  if (SCConfValIsTrue(setting)) {
1004  *out_flags |= flag;
1005  } else {
1006  *out_flags &= ~flag;
1007  }
1008  }
1009 }
1010 
1011 static void JsonAlertLogSetupMetadata(AlertJsonOutputCtx *json_output_ctx, SCConfNode *conf)
1012 {
1013  static bool warn_no_meta = false;
1014  uint32_t payload_buffer_size = JSON_STREAM_BUFFER_SIZE;
1015  uint16_t flags = METADATA_DEFAULTS;
1016 
1017  if (conf != NULL) {
1018  /* Check for metadata to enable/disable. */
1019  SCConfNode *metadata = SCConfNodeLookupChild(conf, "metadata");
1020  if (metadata != NULL) {
1021  if (metadata->val != NULL && SCConfValIsFalse(metadata->val)) {
1023  } else if (SCConfNodeHasChildren(metadata)) {
1024  SCConfNode *rule_metadata = SCConfNodeLookupChild(metadata, "rule");
1025  if (rule_metadata) {
1026  SetFlag(rule_metadata, "raw", LOG_JSON_RULE, &flags);
1027  SetFlag(rule_metadata, "metadata", LOG_JSON_RULE_METADATA,
1028  &flags);
1029  SetFlag(rule_metadata, "reference", LOG_JSON_REFERENCE, &flags);
1030  }
1031  SetFlag(metadata, "flow", LOG_JSON_FLOW, &flags);
1032  SetFlag(metadata, "app-layer", LOG_JSON_APP_LAYER, &flags);
1033  }
1034  }
1035 
1036  /* Non-metadata toggles. */
1037  SetFlag(conf, "payload", LOG_JSON_PAYLOAD_BASE64, &flags);
1038  SetFlag(conf, "packet", LOG_JSON_PACKET, &flags);
1039  SetFlag(conf, "tagged-packets", LOG_JSON_TAGGED_PACKETS, &flags);
1040  SetFlag(conf, "payload-printable", LOG_JSON_PAYLOAD, &flags);
1041  SetFlag(conf, "http-body-printable", LOG_JSON_HTTP_BODY, &flags);
1042  SetFlag(conf, "http-body", LOG_JSON_HTTP_BODY_BASE64, &flags);
1043  SetFlag(conf, "websocket-payload-printable", LOG_JSON_WEBSOCKET_PAYLOAD, &flags);
1044  SetFlag(conf, "websocket-payload", LOG_JSON_WEBSOCKET_PAYLOAD_BASE64, &flags);
1045  SetFlag(conf, "verdict", LOG_JSON_VERDICT, &flags);
1046  SetFlag(conf, "payload-length", LOG_JSON_PAYLOAD_LENGTH, &flags);
1047 
1048  /* Check for obsolete flags and warn that they have no effect. */
1049  static const char *deprecated_flags[] = { "http", "tls", "ssh", "smtp", "dnp3", "app-layer",
1050  "flow", NULL };
1051  for (int i = 0; deprecated_flags[i] != NULL; i++) {
1052  if (SCConfNodeLookupChildValue(conf, deprecated_flags[i]) != NULL) {
1053  SCLogWarning("Found deprecated eve-log.alert flag \"%s\", this flag has no effect",
1054  deprecated_flags[i]);
1055  }
1056  }
1057 
1058  const char *payload_buffer_value = SCConfNodeLookupChildValue(conf, "payload-buffer-size");
1059 
1060  if (payload_buffer_value != NULL) {
1061  uint32_t value;
1062  if (ParseSizeStringU32(payload_buffer_value, &value) < 0) {
1063  SCLogError("Error parsing "
1064  "payload-buffer-size - %s. Killing engine",
1065  payload_buffer_value);
1066  exit(EXIT_FAILURE);
1067  } else if (value == 0) {
1068  // you should not ask for payload if you want 0 of it
1069  SCLogError("Error payload-buffer-size should not be 0");
1070  exit(EXIT_FAILURE);
1071  } else {
1072  payload_buffer_size = value;
1073  }
1074  }
1075 
1076  if (!warn_no_meta && flags & JSON_BODY_LOGGING) {
1077  if (((flags & LOG_JSON_APP_LAYER) == 0)) {
1078  SCLogWarning("HTTP body logging has been configured, however, "
1079  "metadata logging has not been enabled. HTTP body logging will be "
1080  "disabled.");
1082  warn_no_meta = true;
1083  }
1084  }
1085  }
1086 
1087  if (flags & LOG_JSON_RULE_METADATA) {
1089  }
1090 
1091  json_output_ctx->payload_buffer_size = payload_buffer_size;
1092  json_output_ctx->flags |= flags;
1093 }
1094 
1095 static HttpXFFCfg *JsonAlertLogGetXffCfg(SCConfNode *conf)
1096 {
1097  HttpXFFCfg *xff_cfg = NULL;
1098  if (conf != NULL && SCConfNodeLookupChild(conf, "xff") != NULL) {
1099  xff_cfg = SCCalloc(1, sizeof(HttpXFFCfg));
1100  if (likely(xff_cfg != NULL)) {
1101  HttpXFFGetCfg(conf, xff_cfg);
1102  }
1103  }
1104  return xff_cfg;
1105 }
1106 
1107 /**
1108  * \brief Create a new LogFileCtx for "fast" output style.
1109  * \param conf The configuration node for this output.
1110  * \return A LogFileCtx pointer on success, NULL on failure.
1111  */
1112 static OutputInitResult JsonAlertLogInitCtxSub(SCConfNode *conf, OutputCtx *parent_ctx)
1113 {
1114  OutputInitResult result = { NULL, false };
1115  OutputJsonCtx *ajt = parent_ctx->data;
1116  AlertJsonOutputCtx *json_output_ctx = NULL;
1117 
1118  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
1119  if (unlikely(output_ctx == NULL))
1120  return result;
1121 
1122  json_output_ctx = SCCalloc(1, sizeof(AlertJsonOutputCtx));
1123  if (unlikely(json_output_ctx == NULL)) {
1124  goto error;
1125  }
1126 
1127  json_output_ctx->file_ctx = ajt->file_ctx;
1128  json_output_ctx->eve_ctx = ajt;
1129 
1130  JsonAlertLogSetupMetadata(json_output_ctx, conf);
1131  json_output_ctx->xff_cfg = JsonAlertLogGetXffCfg(conf);
1132  if (json_output_ctx->xff_cfg == NULL) {
1133  json_output_ctx->parent_xff_cfg = ajt->xff_cfg;
1134  }
1135 
1136  output_ctx->data = json_output_ctx;
1137  output_ctx->DeInit = JsonAlertLogDeInitCtxSub;
1138 
1139  result.ctx = output_ctx;
1140  result.ok = true;
1141  return result;
1142 
1143 error:
1144  if (json_output_ctx != NULL) {
1145  SCFree(json_output_ctx);
1146  }
1147  if (output_ctx != NULL) {
1148  SCFree(output_ctx);
1149  }
1150 
1151  return result;
1152 }
1153 
1155 {
1156  OutputPacketLoggerFunctions output_logger_functions = {
1157  .LogFunc = JsonAlertLogger,
1158  .ConditionFunc = JsonAlertLogCondition,
1159  .ThreadInitFunc = JsonAlertLogThreadInit,
1160  .ThreadDeinitFunc = JsonAlertLogThreadDeinit,
1161  .ThreadExitPrintStatsFunc = NULL,
1162  };
1163 
1164  OutputRegisterPacketSubModule(LOGGER_JSON_ALERT, "eve-log", MODULE_NAME, "eve-log.alert",
1165  JsonAlertLogInitCtxSub, &output_logger_functions);
1166 }
XFF_MAXLEN
#define XFF_MAXLEN
Definition: app-layer-htp-xff.h:39
PacketCheckAction
bool PacketCheckAction(const Packet *p, const uint8_t a)
Definition: packet.c:50
PACKET_ALERT_FLAG_TX_GUESSED
#define PACKET_ALERT_FLAG_TX_GUESSED
Definition: decode.h:280
Packet_::proto
uint8_t proto
Definition: decode.h:538
TcpStream_
Definition: stream-tcp-private.h:106
FileContainer_
Definition: util-file.h:37
ts
uint64_t ts
Definition: source-erf-file.c:55
DetectMetadataHead::json_str
char * json_str
Definition: detect-metadata.h:40
SCConfValIsTrue
int SCConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:578
detect-engine.h
PacketAlert_::s
const struct Signature_ * s
Definition: decode.h:254
ALPROTO_IKE
@ ALPROTO_IKE
Definition: app-layer-protos.h:55
OutputJsonCtx_::xff_cfg
HttpXFFCfg * xff_cfg
Definition: output-json.h:81
MemBuffer_::buffer
uint8_t buffer[]
Definition: util-buffer.h:30
Signature_::sig_str
char * sig_str
Definition: detect.h:759
ALPROTO_DCERPC
@ ALPROTO_DCERPC
Definition: app-layer-protos.h:44
AppLayerParserGetStateNameById
const char * AppLayerParserGetStateNameById(uint8_t ipproto, AppProto alproto, const int id, const uint8_t direction)
Definition: app-layer-parser.c:1873
DETECT_TABLE_APP_FILTER
@ DETECT_TABLE_APP_FILTER
Definition: detect.h:563
XFF_EXTRADATA
#define XFF_EXTRADATA
Definition: app-layer-htp-xff.h:31
EveAddFlow
void EveAddFlow(Flow *f, SCJsonBuilder *js)
Definition: output-json-flow.c:203
stream-tcp.h
OutputJsonCtx_::cfg
OutputJsonCommonSettings cfg
Definition: output-json.h:80
HttpXFFGetCfg
void HttpXFFGetCfg(SCConfNode *conf, HttpXFFCfg *result)
Function to return XFF configuration from a configuration node.
Definition: app-layer-htp-xff.c:216
PACKET_ALERT_FLAG_STATE_MATCH
#define PACKET_ALERT_FLAG_STATE_MATCH
Definition: decode.h:270
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
EveHttpLogJSONBodyPrintable
void EveHttpLogJSONBodyPrintable(SCJsonBuilder *js, Flow *f, uint64_t tx_id)
Definition: output-json-http.c:384
ACTION_PASS
#define ACTION_PASS
Definition: action-globals.h:34
ACTION_REJECT
#define ACTION_REJECT
Definition: action-globals.h:31
Signature_::app_progress_hook
uint8_t app_progress_hook
Definition: detect.h:719
AppLayerFramesGetContainer
FramesContainer * AppLayerFramesGetContainer(const Flow *f)
Definition: app-layer-parser.c:201
PcapPacketCntGet
uint64_t PcapPacketCntGet(const Packet *p)
Definition: decode.c:1180
LOG_JSON_RULE
#define LOG_JSON_RULE
Definition: output-json-alert.c:84
Signature_::alproto
AppProto alproto
Definition: detect.h:687
DETECT_TABLE_PACKET_PRE_STREAM
@ DETECT_TABLE_PACKET_PRE_STREAM
Definition: detect.h:560
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
AlertJsonOutputCtx_::file_ctx
LogFileCtx * file_ctx
Definition: output-json-alert.c:102
name
const char * name
Definition: detect-engine-proto.c:48
AlertJsonOutputCtx_::parent_xff_cfg
HttpXFFCfg * parent_xff_cfg
Definition: output-json-alert.c:106
FreeEveThreadCtx
void FreeEveThreadCtx(OutputJsonThreadCtx *ctx)
Definition: output-json-common.c:58
Flow_::proto
uint8_t proto
Definition: flow.h:376
EveAddAppProto
void EveAddAppProto(Flow *f, SCJsonBuilder *js)
Definition: output-json-flow.c:183
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:87
AlertJsonStreamDataCallbackData::last_re
uint64_t last_re
Definition: output-json-alert.c:598
Packet_::payload
uint8_t * payload
Definition: decode.h:620
PacketAlerts_::cnt
uint16_t cnt
Definition: decode.h:289
SIG_FLAG_DEST_IS_TARGET
#define SIG_FLAG_DEST_IS_TARGET
Definition: detect.h:284
SCFlowGetAppProtocol
AppProto SCFlowGetAppProtocol(const Flow *f)
Definition: flow.c:1245
action-globals.h
FramesContainer::toserver
Frames toserver
Definition: app-layer-frames.h:72
Packet_::flags
uint32_t flags
Definition: decode.h:562
CreateEveHeader
SCJsonBuilder * CreateEveHeader(const Packet *p, enum SCOutputJsonLogDirection dir, const char *event_type, JsonAddrInfo *addr, OutputJsonCtx *eve_ctx)
Definition: output-json.c:819
LOGGER_JSON_ALERT
@ LOGGER_JSON_ALERT
Definition: suricata-common.h:504
OutputJsonCtx_
Definition: output-json.h:77
Frame
Definition: app-layer-frames.h:43
Flow_
Flow data structure.
Definition: flow.h:354
OutputJsonCommonSettings_
Definition: output-json.h:62
JsonAddrInfoInit
void JsonAddrInfoInit(const Packet *p, enum SCOutputJsonLogDirection dir, JsonAddrInfo *addr, OutputJsonCommonSettings *cfg)
Definition: output-json.c:467
AppProtoToString
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
Definition: app-layer-protos.c:41
LogFileCtx_
Definition: util-logopenfile.h:77
output-json-frame.h
AlertJsonHeader
void AlertJsonHeader(const Packet *p, const PacketAlert *pa, SCJsonBuilder *js, uint16_t flags, JsonAddrInfo *addr, char *xff_buffer)
Definition: output-json-alert.c:206
PacketAlerts_::alerts
PacketAlert * alerts
Definition: decode.h:293
CreateEveThreadCtx
OutputJsonThreadCtx * CreateEveThreadCtx(ThreadVars *t, OutputJsonCtx *ctx)
Definition: output-json-common.c:29
AlertJsonStreamDataCallbackData::payload
MemBuffer * payload
Definition: output-json-alert.c:597
json_addr_info_zero
const JsonAddrInfo json_addr_info_zero
Definition: output-json.c:81
FLOW_PKT_TOSERVER
#define FLOW_PKT_TOSERVER
Definition: flow.h:231
rust.h
Frames
Definition: app-layer-frames.h:58
ACTION_REJECT_ANY
#define ACTION_REJECT_ANY
Definition: action-globals.h:38
FramesContainer
Definition: app-layer-frames.h:71
SCConfValIsFalse
int SCConfValIsFalse(const char *val)
Check if a value is false.
Definition: conf.c:603
ACTION_DROP_REJECT
#define ACTION_DROP_REJECT
Definition: action-globals.h:40
OutputJsonBuilderBuffer
void OutputJsonBuilderBuffer(ThreadVars *tv, const Packet *p, Flow *f, SCJsonBuilder *js, OutputJsonThreadCtx *ctx)
Definition: output-json.c:1021
proto
uint8_t proto
Definition: decode-template.h:0
p
Packet * p
Definition: fuzz_iprep.c:21
SCConfNodeLookupChildValue
const char * SCConfNodeLookupChildValue(const SCConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:878
AlertJsonOutputCtx_::eve_ctx
OutputJsonCtx * eve_ctx
Definition: output-json-alert.c:107
app-layer-ftp.h
Packet_::flowflags
uint8_t flowflags
Definition: decode.h:547
EngineModeIsFirewall
bool EngineModeIsFirewall(void)
Definition: suricata.c:239
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:82
Flow_::protoctx
void * protoctx
Definition: flow.h:433
DetectFirewallPolicy::action
uint8_t action
Definition: detect.h:933
Packet_::payload_len
uint16_t payload_len
Definition: decode.h:621
SCConfNodeHasChildren
bool SCConfNodeHasChildren(const SCConfNode *node)
Check if a node has any children.
Definition: conf.c:834
Packet_::alerts
PacketAlerts alerts
Definition: decode.h:637
MemBuffer_::offset
uint32_t offset
Definition: util-buffer.h:29
EveHttpAddMetadata
bool EveHttpAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *js)
Definition: output-json-http.c:488
HttpXFFGetIP
int HttpXFFGetIP(const Flow *f, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbuflen)
Function to return XFF IP if any. The caller needs to lock the flow.
Definition: app-layer-htp-xff.c:183
OutputCtx_::data
void * data
Definition: tm-modules.h:91
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
PcapLogGetFilename
char * PcapLogGetFilename(void)
Definition: log-pcap.c:1832
AppLayerParserGetTxFiles
AppLayerGetFileState AppLayerParserGetTxFiles(const Flow *f, void *tx, const uint8_t direction)
Definition: app-layer-parser.c:958
PacketAlert_::tx_id
uint64_t tx_id
Definition: decode.h:255
EveSMBAddMetadata
bool EveSMBAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *jb)
Definition: output-json-smb.c:34
OutputCtx_
Definition: tm-modules.h:88
app-layer-htp-xff.h
PacketAlert_::action
uint8_t action
Definition: decode.h:251
strlcpy
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: util-strlcpyu.c:43
JSON_BODY_LOGGING
#define JSON_BODY_LOGGING
Definition: output-json-alert.c:95
SIG_FLAG_FIREWALL
#define SIG_FLAG_FIREWALL
Definition: detect.h:245
OutputJsonThreadCtx_
Definition: output-json.h:85
Signature_::gid
uint32_t gid
Definition: detect.h:728
ACTION_REJECT_DST
#define ACTION_REJECT_DST
Definition: action-globals.h:32
EveIKEAddMetadata
bool EveIKEAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *js)
Definition: output-json-ike.c:65
JsonAddrInfo_::dp
Port dp
Definition: output-json.h:45
SIG_FLAG_TOSERVER
#define SIG_FLAG_TOSERVER
Definition: detect.h:270
FramesContainer::toclient
Frames toclient
Definition: app-layer-frames.h:73
JsonAlertLogThread_::ctx
OutputJsonThreadCtx * ctx
Definition: output-json-alert.c:113
PacketAlert_::json_info
struct PacketContextData * json_info
Definition: decode.h:257
EveSMTPAddMetadata
bool EveSMTPAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *js)
Definition: output-json-smtp.c:100
util-debug.h
JB_SET_STRING
#define JB_SET_STRING(jb, key, val)
Definition: rust.h:36
output-json-flow.h
MODULE_NAME
#define MODULE_NAME
Definition: output-json-alert.c:73
PKT_IS_TOSERVER
#define PKT_IS_TOSERVER(p)
Definition: decode.h:239
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:47
LOG_JSON_APP_LAYER
#define LOG_JSON_APP_LAYER
Definition: output-json-alert.c:79
LOG_JSON_WEBSOCKET_PAYLOAD
#define LOG_JSON_WEBSOCKET_PAYLOAD
Definition: output-json-alert.c:86
output-json.h
FrameGetById
Frame * FrameGetById(Frames *frames, const int64_t id)
Definition: app-layer-frames.c:125
DetectReference_::key_len
uint16_t key_len
Definition: detect-reference.h:40
ALPROTO_SMTP
@ ALPROTO_SMTP
Definition: app-layer-protos.h:38
LOG_JSON_PAYLOAD
#define LOG_JSON_PAYLOAD
Definition: output-json-alert.c:75
STREAM_BASE_OFFSET
#define STREAM_BASE_OFFSET(stream)
Definition: stream-tcp-private.h:144
PktSrcEnum
PktSrcEnum
Definition: decode.h:51
util-reference-config.h
AlertJsonOutputCtx_::flags
uint16_t flags
Definition: output-json-alert.c:103
util-print.h
EveNFSAddMetadata
bool EveNFSAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *jb)
Definition: output-json-nfs.c:62
Signature_::references
DetectReference * references
Definition: detect.h:755
FileContainer_::head
File * head
Definition: util-file.h:38
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
PacketContextData
Definition: decode.h:242
DETECT_TABLE_PACKET_PRE_FLOW
@ DETECT_TABLE_PACKET_PRE_FLOW
Definition: detect.h:559
EveNFSAddMetadataRPC
bool EveNFSAddMetadataRPC(const Flow *f, uint64_t tx_id, SCJsonBuilder *jb)
Definition: output-json-nfs.c:50
PktSrcToString
const char * PktSrcToString(enum PktSrcEnum pkt_src)
Definition: decode.c:881
DETECT_TABLE_PACKET_FILTER
@ DETECT_TABLE_PACKET_FILTER
Definition: detect.h:561
DetectFirewallPolicyToString
void DetectFirewallPolicyToString(const struct DetectFirewallPolicy *p, char *out, size_t out_size)
Definition: detect-parse.c:4040
JsonAlertLogThread
struct JsonAlertLogThread_ JsonAlertLogThread
output-json-email-common.h
util-time.h
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
JsonAlertLogThread_
Definition: output-json-alert.c:110
DetectReference_
Signature reference list.
Definition: detect-reference.h:30
AppLayerParserGetStateProgress
int AppLayerParserGetStateProgress(uint8_t ipproto, AppProto alproto, void *tx, uint8_t flags)
get the progress value for a tx/protocol
Definition: app-layer-parser.c:1225
Signature_::action
uint8_t action
Definition: detect.h:697
SCEveJsonSimpleGetLogger
EveJsonSimpleAppLayerLogger * SCEveJsonSimpleGetLogger(AppProto alproto)
Definition: output.c:923
Signature_::flags
uint32_t flags
Definition: detect.h:683
stream.h
DetectReference_::reference_len
uint16_t reference_len
Definition: detect-reference.h:41
JsonAddrInfo_
Definition: output-json.h:41
ACTION_ALERT
#define ACTION_ALERT
Definition: action-globals.h:29
Packet_
Definition: decode.h:516
EveFileInfo
void EveFileInfo(SCJsonBuilder *jb, const File *ff, const uint64_t tx_id, const uint16_t flags)
Definition: output-json.c:124
DetectReference_::reference
char * reference
Definition: detect-reference.h:34
JSON_STREAM_BUFFER_SIZE
#define JSON_STREAM_BUFFER_SIZE
Definition: output-json-alert.c:99
LOG_JSON_PAYLOAD_BASE64
#define LOG_JSON_PAYLOAD_BASE64
Definition: output-json-alert.c:77
conf.h
DETECT_MAX_RULE_SIZE
#define DETECT_MAX_RULE_SIZE
Definition: detect.h:46
SIG_FLAG_HAS_TARGET
#define SIG_FLAG_HAS_TARGET
Definition: detect.h:286
XFF_OVERWRITE
#define XFF_OVERWRITE
Definition: app-layer-htp-xff.h:33
LOG_JSON_PAYLOAD_LENGTH
#define LOG_JSON_PAYLOAD_LENGTH
Definition: output-json-alert.c:88
TmEcode
TmEcode
Definition: tm-threads-common.h:80
SIG_FLAG_SRC_IS_TARGET
#define SIG_FLAG_SRC_IS_TARGET
Definition: detect.h:282
HttpXFFCfg_
Definition: app-layer-htp-xff.h:41
AlertJsonOutputCtx_::payload_buffer_size
uint32_t payload_buffer_size
Definition: output-json-alert.c:104
EvePacket
void EvePacket(const Packet *p, SCJsonBuilder *js, uint32_t max_length)
Jsonify a packet.
Definition: output-json.c:422
MemBuffer_
Definition: util-buffer.h:27
FLOW_PKT_TOCLIENT
#define FLOW_PKT_TOCLIENT
Definition: flow.h:232
EveJsonSimpleAppLayerLogger
Definition: output-eve-bindgen.h:42
DetectReference_::next
struct DetectReference_ * next
Definition: detect-reference.h:43
LOG_JSON_TAGGED_PACKETS
#define LOG_JSON_TAGGED_PACKETS
Definition: output-json-alert.c:78
AppLayerParserGetTx
void * AppLayerParserGetTx(uint8_t ipproto, AppProto alproto, void *alstate, uint64_t tx_id)
Definition: app-layer-parser.c:1245
AlertJsonOutputCtx_::xff_cfg
HttpXFFCfg * xff_cfg
Definition: output-json-alert.c:105
PACKET_ALERT_FLAG_STREAM_MATCH
#define PACKET_ALERT_FLAG_STREAM_MATCH
Definition: decode.h:272
PACKET_ALERT_FLAG_FRAME
#define PACKET_ALERT_FLAG_FRAME
Definition: decode.h:278
log-pcap.h
PacketAlert_::frame_id
int64_t frame_id
Definition: decode.h:256
JsonAddrInfo_::proto
char proto[JSON_PROTO_LEN]
Definition: output-json.h:46
Signature_::class_msg
char * class_msg
Definition: detect.h:753
PacketAlert_::flags
uint8_t flags
Definition: decode.h:252
ACTION_REJECT_BOTH
#define ACTION_REJECT_BOTH
Definition: action-globals.h:33
File_::flags
uint16_t flags
Definition: util-file.h:147
SCConfNodeLookupChild
SCConfNode * SCConfNodeLookupChild(const SCConfNode *node, const char *name)
Lookup a child configuration node by name.
Definition: conf.c:850
File_
Definition: util-file.h:146
PacketAlert_::sub_state
uint8_t sub_state
Definition: decode.h:253
OutputInitResult_
Definition: output.h:46
app-layer-frames.h
Packet_::flow
struct Flow_ * flow
Definition: decode.h:564
Packet_::tenant_id
uint32_t tenant_id
Definition: decode.h:678
EveEmailAddMetadata
bool EveEmailAddMetadata(const Flow *f, uint64_t tx_id, SCJsonBuilder *js)
Definition: output-json-email-common.c:195
flags
uint8_t flags
Definition: decode-gre.h:0
AppLayerGetFileState
Definition: util-file.h:44
suricata-common.h
LOG_JSON_WEBSOCKET_PAYLOAD_BASE64
#define LOG_JSON_WEBSOCKET_PAYLOAD_BASE64
Definition: output-json-alert.c:87
JsonAddrInfo_::sp
Port sp
Definition: output-json.h:44
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:94
AppLayerGetFileState::fc
FileContainer * fc
Definition: util-file.h:45
pcap_filename
char pcap_filename[PATH_MAX]
Definition: source-pcap-file-helper.c:166
EveJsonSimpleAppLayerLogger::LogTx
EveJsonSimpleTxLogFunc LogTx
Definition: output-eve-bindgen.h:43
JSON_ADDR_LEN
#define JSON_ADDR_LEN
Definition: output-json.h:37
AlertJsonOutputCtx_
Definition: output-json-alert.c:101
detect-metadata.h
Signature_::action_scope
uint8_t action_scope
Definition: detect.h:704
JsonAlertLogThread_::json_output_ctx
AlertJsonOutputCtx * json_output_ctx
Definition: output-json-alert.c:112
output-json-nfs.h
packet.h
ALPROTO_HTTP1
@ ALPROTO_HTTP1
Definition: app-layer-protos.h:36
MemBufferFree
void MemBufferFree(MemBuffer *buffer)
Definition: util-buffer.c:86
LOG_JSON_VERDICT
#define LOG_JSON_VERDICT
Definition: output-json-alert.c:85
File_::next
struct File_ * next
Definition: util-file.h:159
ACTION_DROP
#define ACTION_DROP
Definition: action-globals.h:30
OutputPacketLoggerFunctions_::LogFunc
PacketLogger LogFunc
Definition: output.h:87
PacketGetAction
uint8_t PacketGetAction(const Packet *p)
Definition: packet.c:61
Signature_::rev
uint32_t rev
Definition: detect.h:729
AppLayerParserGetSubStateProgressName
const char * AppLayerParserGetSubStateProgressName(const AppProto alproto, const uint8_t sub_state, const uint8_t state, const uint8_t dir_flag)
Definition: app-layer-parser.c:1303
ALPROTO_WEBSOCKET
@ ALPROTO_WEBSOCKET
Definition: app-layer-protos.h:64
TcpSession_::client
TcpStream client
Definition: stream-tcp-private.h:297
PacketContextData::next
struct PacketContextData * next
Definition: decode.h:244
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:33
Signature_::prio
int prio
Definition: detect.h:730
ParseSizeStringU32
int ParseSizeStringU32(const char *size, uint32_t *res)
Definition: util-misc.c:174
output-json-alert.h
util-optimize.h
threadvars.h
util-validate.h
Packet_::root
struct Packet_ * root
Definition: decode.h:666
TcpSession_::server
TcpStream server
Definition: stream-tcp-private.h:296
JsonAddrInfo_::src_ip
char src_ip[JSON_ADDR_LEN]
Definition: output-json.h:42
EveAddVerdict
void EveAddVerdict(SCJsonBuilder *jb, const Packet *p, const uint8_t alert_action)
Build verdict object.
Definition: output-json-alert.c:546
PACKET_ALERT_FLAG_RATE_FILTER_MODIFIED
#define PACKET_ALERT_FLAG_RATE_FILTER_MODIFIED
Definition: decode.h:276
HttpXFFCfg_::flags
uint8_t flags
Definition: app-layer-htp-xff.h:42
Signature_::metadata
DetectMetadataHead * metadata
Definition: detect.h:757
DetectFirewallPolicy
Definition: detect.h:932
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:274
EveHttpLogJSONBodyBase64
void EveHttpLogJSONBodyBase64(SCJsonBuilder *js, Flow *f, uint64_t tx_id)
Definition: output-json-http.c:413
AlertJsonOutputCtx
struct AlertJsonOutputCtx_ AlertJsonOutputCtx
JsonAlertLogThread_::payload_buffer
MemBuffer * payload_buffer
Definition: output-json-alert.c:111
SCFree
#define SCFree(p)
Definition: util-mem.h:61
AppLayerParserGetSubStateName
const char * AppLayerParserGetSubStateName(const AppProto alproto, const uint8_t sub_state)
Definition: app-layer-parser.c:1352
Packet_::pkt_src
uint8_t pkt_src
Definition: decode.h:626
DetectReference_::key
char * key
Definition: detect-reference.h:32
util-logopenfile.h
Flow_::alstate
void * alstate
Definition: flow.h:479
Signature_::id
uint32_t id
Definition: detect.h:727
Packet_::recursion_level
uint8_t recursion_level
Definition: decode.h:541
LOG_JSON_HTTP_BODY_BASE64
#define LOG_JSON_HTTP_BODY_BASE64
Definition: output-json-alert.c:82
output-json-ike.h
detect-parse.h
FrameJsonLogOneFrame
void FrameJsonLogOneFrame(const uint8_t ipproto, const Frame *frame, Flow *f, const TcpStream *stream, const Packet *p, SCJsonBuilder *jb, MemBuffer *buffer)
log a single frame
Definition: output-json-frame.c:239
util-buffer.h
Signature_
Signature container.
Definition: detect.h:682
LOG_JSON_PACKET
#define LOG_JSON_PACKET
Definition: output-json-alert.c:76
flow-bindgen.h
PACKET_ALERT_FLAG_TX
#define PACKET_ALERT_FLAG_TX
Definition: decode.h:274
JsonAddrInfo_::dst_ip
char dst_ip[JSON_ADDR_LEN]
Definition: output-json.h:43
OutputJsonCtx_::file_ctx
LogFileCtx * file_ctx
Definition: output-json.h:78
LOG_JSON_HTTP_BODY
#define LOG_JSON_HTTP_BODY
Definition: output-json-alert.c:81
METADATA_DEFAULTS
#define METADATA_DEFAULTS
Definition: output-json-alert.c:91
ACTION_ACCEPT
#define ACTION_ACCEPT
Definition: action-globals.h:36
EngineModeIsIPS
int EngineModeIsIPS(void)
Definition: suricata.c:246
LOG_JSON_FLOW
#define LOG_JSON_FLOW
Definition: output-json-alert.c:80
MemBufferWriteRaw
uint32_t MemBufferWriteRaw(MemBuffer *dst, const uint8_t *raw, const uint32_t raw_len)
Write a raw buffer to the MemBuffer dst.
Definition: util-buffer.c:115
PacketAlert_
Definition: decode.h:249
MemBufferWriteString
void MemBufferWriteString(MemBuffer *dst, const char *fmt,...)
Definition: util-buffer.c:130
LOG_DIR_PACKET
@ LOG_DIR_PACKET
Definition: output-eve-bindgen.h:34
Signature_::detect_table
uint8_t detect_table
Definition: detect.h:716
output-json-smb.h
ALPROTO_SMB
@ ALPROTO_SMB
Definition: app-layer-protos.h:43
likely
#define likely(expr)
Definition: util-optimize.h:32
IPPROTO_SCTP
#define IPPROTO_SCTP
Definition: decode.h:1273
PacketContextData::json_string
char * json_string
Definition: decode.h:243
HttpXFFGetIPFromTx
int HttpXFFGetIPFromTx(const Flow *f, uint64_t tx_id, HttpXFFCfg *xff_cfg, char *dstbuf, int dstbuflen)
Function to return XFF IP if any in the selected transaction. The caller needs to lock the flow.
Definition: app-layer-htp-xff.c:152
output-json-smtp.h
TcpSession_
Definition: stream-tcp-private.h:283
output-json-http.h
util-misc.h
PKT_HAS_TAG
#define PKT_HAS_TAG
Definition: decode.h:1303
Signature_::msg
char * msg
Definition: detect.h:750
flow.h
DetectEngineSetParseMetadata
void DetectEngineSetParseMetadata(void)
Definition: detect-engine.c:5243
Flow_::alproto
AppProto alproto
application level protocol
Definition: flow.h:450
StreamReassembleLog
int StreamReassembleLog(const TcpSession *ssn, const TcpStream *stream, StreamReassembleRawFunc Callback, void *cb_data, const uint64_t progress_in, uint64_t *progress_out, const bool eof)
Definition: stream-tcp-reassemble.c:1968
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
SCConfNode_
Definition: conf.h:37
LOG_JSON_RULE_METADATA
#define LOG_JSON_RULE_METADATA
Definition: output-json-alert.c:83
OutputPacketLoggerFunctions_
Definition: output.h:86
SCConfNode_::val
char * val
Definition: conf.h:39
XFF_DISABLED
#define XFF_DISABLED
Definition: app-layer-htp-xff.h:29
DEBUG_VALIDATE_BUG_ON
#define DEBUG_VALIDATE_BUG_ON(exp)
Definition: util-validate.h:109
LOG_JSON_REFERENCE
#define LOG_JSON_REFERENCE
Definition: output-json-alert.c:89
ALPROTO_NFS
@ ALPROTO_NFS
Definition: app-layer-protos.h:51
MemBufferCreateNew
MemBuffer * MemBufferCreateNew(uint32_t size)
Definition: util-buffer.c:32
output.h
JsonAlertLogRegister
void JsonAlertLogRegister(void)
Definition: output-json-alert.c:1154
AlertJsonStreamDataCallbackData
Definition: output-json-alert.c:596