suricata
output-json-stats.c
Go to the documentation of this file.
1 /* Copyright (C) 2014-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  * Implements JSON stats counters logging portion of the engine.
24  */
25 
26 #include "suricata-common.h"
27 #include "detect.h"
28 #include "pkt-var.h"
29 #include "conf.h"
30 #include "detect-engine.h"
31 
32 #include "threads.h"
33 #include "threadvars.h"
34 #include "tm-threads.h"
35 
36 #include "util-print.h"
37 #include "util-validate.h"
38 
39 #include "util-debug.h"
40 #include "output.h"
41 #include "util-privs.h"
42 #include "util-buffer.h"
43 
44 #include "util-logopenfile.h"
45 
46 #include "output-json.h"
47 #include "output-json-stats.h"
48 
49 #define MODULE_NAME "JsonStatsLog"
50 
51 extern bool stats_decoder_events;
52 extern const char *stats_decoder_events_prefix;
53 
54 /**
55  * specify which engine info will be printed in stats log.
56  * ALL means both last reload and ruleset stats.
57  */
58 typedef enum OutputEngineInfo_ {
63 
64 typedef struct OutputStatsCtx_ {
66  uint8_t flags; /** Store mode */
68 
69 typedef struct JsonStatsLogThread_ {
74 
75 static json_t *EngineStats2Json(const DetectEngineCtx *de_ctx,
76  const OutputEngineInfo output)
77 {
78  char timebuf[64];
79  const SigFileLoaderStat *sig_stat = NULL;
80 
81  json_t *jdata = json_object();
82  if (jdata == NULL) {
83  return NULL;
84  }
85 
86  if (output == OUTPUT_ENGINE_LAST_RELOAD || output == OUTPUT_ENGINE_ALL) {
88  CreateIsoTimeString(last_reload, timebuf, sizeof(timebuf));
89  json_object_set_new(jdata, "last_reload", json_string(timebuf));
90  }
91 
92  sig_stat = &de_ctx->sig_stat;
93  if ((output == OUTPUT_ENGINE_RULESET || output == OUTPUT_ENGINE_ALL) &&
94  sig_stat != NULL)
95  {
96  json_object_set_new(jdata, "rules_loaded",
97  json_integer(sig_stat->good_sigs_total));
98  json_object_set_new(jdata, "rules_failed",
99  json_integer(sig_stat->bad_sigs_total));
100  json_object_set_new(jdata, "rules_skipped", json_integer(sig_stat->skipped_sigs_total));
101  }
102 
103  return jdata;
104 }
105 
106 static TmEcode OutputEngineStats2Json(json_t **jdata, const OutputEngineInfo output)
107 {
109  if (de_ctx == NULL) {
110  goto err1;
111  }
112  /* Since we need to deference de_ctx pointer, we don't want to lost it. */
113  DetectEngineCtx *list = de_ctx;
114 
115  json_t *js_tenant_list = json_array();
116  json_t *js_tenant = NULL;
117 
118  if (js_tenant_list == NULL) {
119  goto err2;
120  }
121 
122  while(list) {
123  js_tenant = json_object();
124  if (js_tenant == NULL) {
125  goto err3;
126  }
127  json_object_set_new(js_tenant, "id", json_integer(list->tenant_id));
128 
129  json_t *js_stats = EngineStats2Json(list, output);
130  if (js_stats == NULL) {
131  goto err4;
132  }
133  json_object_update(js_tenant, js_stats);
134  json_array_append_new(js_tenant_list, js_tenant);
135  json_decref(js_stats);
136  list = list->next;
137  }
138 
140  *jdata = js_tenant_list;
141  return TM_ECODE_OK;
142 
143 err4:
144  json_object_clear(js_tenant);
145  json_decref(js_tenant);
146 
147 err3:
148  json_object_clear(js_tenant_list);
149  json_decref(js_tenant_list);
150 
151 err2:
153 
154 err1:
155  json_object_set_new(*jdata, "message", json_string("Unable to get info"));
156  return TM_ECODE_FAILED;
157 }
158 
160  return OutputEngineStats2Json(jdata, OUTPUT_ENGINE_LAST_RELOAD);
161 }
162 
164  return OutputEngineStats2Json(jdata, OUTPUT_ENGINE_RULESET);
165 }
166 
167 static json_t *OutputStats2Json(json_t *js, const char *key)
168 {
169  void *iter;
170 
171  const char *dot = strchr(key, '.');
172  if (dot == NULL)
173  return NULL;
174  if (strlen(dot) > 2) {
175  if (*(dot + 1) == '.' && *(dot + 2) != '\0')
176  dot = strchr(dot + 2, '.');
177  }
178 
179  size_t predot_len = (dot - key) + 1;
180  char s[predot_len];
181  strlcpy(s, key, predot_len);
182 
183  iter = json_object_iter_at(js, s);
184  const char *s2 = strchr(dot+1, '.');
185 
186  json_t *value = json_object_iter_value(iter);
187  if (value == NULL) {
188  value = json_object();
189 
190  if (!strncmp(s, "detect", 6)) {
191  json_t *js_engine = NULL;
192 
193  TmEcode ret = OutputEngineStats2Json(&js_engine, OUTPUT_ENGINE_ALL);
194  if (ret == TM_ECODE_OK && js_engine) {
195  json_object_set_new(value, "engines", js_engine);
196  }
197  }
198  json_object_set_new(js, s, value);
199  }
200  if (s2 != NULL) {
201  return OutputStats2Json(value, &key[dot-key+1]);
202  }
203  return value;
204 }
205 
206 /** \brief turn StatsTable into a json object
207  * \param flags JSON_STATS_* flags for controlling output
208  */
209 json_t *StatsToJSON(const StatsTable *st, uint8_t flags)
210 {
211  const char delta_suffix[] = "_delta";
212  struct timeval tval;
213  gettimeofday(&tval, NULL);
214 
215  json_t *js_stats = json_object();
216  if (unlikely(js_stats == NULL)) {
217  return NULL;
218  }
219 
220  /* Uptime, in seconds. */
221  double up_time_d = difftime(tval.tv_sec, st->start_time);
222  json_object_set_new(js_stats, "uptime",
223  json_integer((int)up_time_d));
224 
225  uint32_t u = 0;
226  if (flags & JSON_STATS_TOTALS) {
227  for (u = 0; u < st->nstats; u++) {
228  if (st->stats[u].name == NULL)
229  continue;
230  if (flags & JSON_STATS_NO_ZEROES && st->stats[u].value == 0) {
231  continue;
232  }
233 
234  json_t *js_type = NULL;
235  const char *stat_name = st->stats[u].short_name;
236  /*
237  * When there's no short-name, the stat is added to
238  * the "global" stats namespace, just like "uptime"
239  */
240  if (st->stats[u].short_name == NULL) {
241  stat_name = st->stats[u].name;
242  js_type = js_stats;
243  } else {
244  js_type = OutputStats2Json(js_stats, st->stats[u].name);
245  }
246  if (js_type != NULL) {
247  json_object_set_new(js_type, stat_name, json_integer(st->stats[u].value));
248 
249  if (flags & JSON_STATS_DELTAS) {
250  /* add +1 to safisfy gcc 15 + -Wformat-truncation=2 */
251  char deltaname[strlen(stat_name) + strlen(delta_suffix) + 2];
252  snprintf(deltaname, sizeof(deltaname), "%s%s", stat_name, delta_suffix);
253  json_object_set_new(js_type, deltaname,
254  json_integer(st->stats[u].value - st->stats[u].pvalue));
255  }
256  }
257  }
258  }
259 
260  /* per thread stats - stored in a "threads" object. */
261  if (st->tstats != NULL && (flags & JSON_STATS_THREADS)) {
262  /* for each thread (store) */
263  json_t *threads = json_object();
264  if (unlikely(threads == NULL)) {
265  json_decref(js_stats);
266  return NULL;
267  }
268  uint32_t x;
269  for (x = 0; x < st->ntstats; x++) {
270  uint32_t offset = x * st->nstats;
271  const char *tm_name = NULL;
272  json_t *thread = NULL;
273 
274  /* for each counter */
275  for (u = offset; u < (offset + st->nstats); u++) {
276  if (st->tstats[u].name == NULL)
277  continue;
278  if (flags & JSON_STATS_NO_ZEROES && st->tstats[u].value == 0) {
279  continue;
280  }
281 
282  DEBUG_VALIDATE_BUG_ON(st->tstats[u].tm_name == NULL);
283 
284  if (tm_name == NULL) {
285  // First time we see a set tm_name. Remember it
286  // and allocate the stats object for this thread.
287  tm_name = st->tstats[u].tm_name;
288  thread = json_object();
289  if (unlikely(thread == NULL)) {
290  json_decref(js_stats);
291  json_decref(threads);
292  return NULL;
293  }
294  } else {
295  DEBUG_VALIDATE_BUG_ON(strcmp(tm_name, st->tstats[u].tm_name) != 0);
296  DEBUG_VALIDATE_BUG_ON(thread == NULL);
297  }
298 
299  json_t *js_type = NULL;
300  const char *stat_name = st->tstats[u].short_name;
301  if (st->tstats[u].short_name == NULL) {
302  stat_name = st->tstats[u].name;
303  js_type = threads;
304  } else {
305  js_type = OutputStats2Json(thread, st->tstats[u].name);
306  }
307 
308  if (js_type != NULL) {
309  json_object_set_new(js_type, stat_name, json_integer(st->tstats[u].value));
310 
311  if (flags & JSON_STATS_DELTAS) {
312  char deltaname[strlen(stat_name) + strlen(delta_suffix) + 2];
313  snprintf(deltaname, sizeof(deltaname), "%s%s", stat_name, delta_suffix);
314  json_object_set_new(js_type, deltaname,
315  json_integer(st->tstats[u].value - st->tstats[u].pvalue));
316  }
317  }
318  }
319  if (tm_name != NULL) {
320  DEBUG_VALIDATE_BUG_ON(thread == NULL);
321  json_object_set_new(threads, tm_name, thread);
322  }
323  }
324  json_object_set_new(js_stats, "threads", threads);
325  }
326  return js_stats;
327 }
328 
329 static int JsonStatsLogger(ThreadVars *tv, void *thread_data, const StatsTable *st)
330 {
331  SCEnter();
332  JsonStatsLogThread *aft = (JsonStatsLogThread *)thread_data;
333 
334  struct timeval tval;
335  gettimeofday(&tval, NULL);
336 
337  json_t *js = json_object();
338  if (unlikely(js == NULL))
339  return 0;
340  char timebuf[64];
341  CreateIsoTimeString(SCTIME_FROM_TIMEVAL(&tval), timebuf, sizeof(timebuf));
342  json_object_set_new(js, "timestamp", json_string(timebuf));
343  json_object_set_new(js, "event_type", json_string("stats"));
344 
345  json_t *js_stats = StatsToJSON(st, aft->statslog_ctx->flags);
346  if (js_stats == NULL) {
347  json_decref(js);
348  return 0;
349  }
350 
351  json_object_set_new(js, "stats", js_stats);
352 
353  OutputJSONBuffer(js, aft->file_ctx, &aft->buffer);
354  MemBufferReset(aft->buffer);
355 
356  json_object_clear(js_stats);
357  json_object_del(js, "stats");
358  json_object_clear(js);
359  json_decref(js);
360 
361  SCReturnInt(0);
362 }
363 
364 static TmEcode JsonStatsLogThreadInit(ThreadVars *t, const void *initdata, void **data)
365 {
367  if (unlikely(aft == NULL))
368  return TM_ECODE_FAILED;
369 
370  if(initdata == NULL)
371  {
372  SCLogDebug("Error getting context for EveLogStats. \"initdata\" argument NULL");
373  goto error_exit;
374  }
375 
377  if (aft->buffer == NULL) {
378  goto error_exit;
379  }
380 
381  /* Use the Output Context (file pointer and mutex) */
382  aft->statslog_ctx = ((OutputCtx *)initdata)->data;
383 
385  if (!aft->file_ctx) {
386  goto error_exit;
387  }
388 
389  *data = (void *)aft;
390  return TM_ECODE_OK;
391 
392 error_exit:
393  if (aft->buffer != NULL) {
394  MemBufferFree(aft->buffer);
395  }
396  SCFree(aft);
397  return TM_ECODE_FAILED;
398 }
399 
400 static TmEcode JsonStatsLogThreadDeinit(ThreadVars *t, void *data)
401 {
402  JsonStatsLogThread *aft = (JsonStatsLogThread *)data;
403  if (aft == NULL) {
404  return TM_ECODE_OK;
405  }
406 
407  MemBufferFree(aft->buffer);
408 
409  /* clear memory */
410  memset(aft, 0, sizeof(JsonStatsLogThread));
411 
412  SCFree(aft);
413  return TM_ECODE_OK;
414 }
415 
416 static void OutputStatsLogDeinitSub(OutputCtx *output_ctx)
417 {
418  OutputStatsCtx *stats_ctx = output_ctx->data;
419  SCFree(stats_ctx);
420  SCFree(output_ctx);
421 }
422 
423 static OutputInitResult OutputStatsLogInitSub(SCConfNode *conf, OutputCtx *parent_ctx)
424 {
425  OutputInitResult result = { NULL, false };
426  OutputJsonCtx *ajt = parent_ctx->data;
427 
428  if (!StatsEnabled()) {
429  SCLogError("eve.stats: stats are disabled globally: set stats.enabled to true. "
430  "See %s/configuration/suricata-yaml.html#stats",
431  GetDocURL());
432  return result;
433  }
434 
435  OutputStatsCtx *stats_ctx = SCMalloc(sizeof(OutputStatsCtx));
436  if (unlikely(stats_ctx == NULL))
437  return result;
438 
439  if (stats_decoder_events &&
440  strcmp(stats_decoder_events_prefix, "decoder") == 0) {
441  SCLogWarning("eve.stats will not display "
442  "all decoder events correctly. See ticket #2225. Set a prefix in "
443  "stats.decoder-events-prefix.");
444  }
445 
446  stats_ctx->flags = JSON_STATS_TOTALS;
447 
448  if (conf != NULL) {
449  const char *totals = SCConfNodeLookupChildValue(conf, "totals");
450  const char *threads = SCConfNodeLookupChildValue(conf, "threads");
451  const char *deltas = SCConfNodeLookupChildValue(conf, "deltas");
452  const char *zero_counters = SCConfNodeLookupChildValue(conf, "null-values");
453  SCLogDebug("totals %s threads %s deltas %s", totals, threads, deltas);
454 
455  if ((totals != NULL && SCConfValIsFalse(totals)) &&
456  (threads != NULL && SCConfValIsFalse(threads))) {
457  SCFree(stats_ctx);
458  SCLogError("Cannot disable both totals and threads in stats logging");
459  return result;
460  }
461 
462  if (totals != NULL && SCConfValIsFalse(totals)) {
463  stats_ctx->flags &= ~JSON_STATS_TOTALS;
464  }
465  if (threads != NULL && SCConfValIsTrue(threads)) {
466  stats_ctx->flags |= JSON_STATS_THREADS;
467  }
468  if (deltas != NULL && SCConfValIsTrue(deltas)) {
469  stats_ctx->flags |= JSON_STATS_DELTAS;
470  }
471  if (zero_counters != NULL && SCConfValIsFalse(zero_counters)) {
472  stats_ctx->flags |= JSON_STATS_NO_ZEROES;
473  }
474  SCLogDebug("stats_ctx->flags %08x", stats_ctx->flags);
475  }
476 
477  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
478  if (unlikely(output_ctx == NULL)) {
479  SCFree(stats_ctx);
480  return result;
481  }
482 
483  SCLogDebug("Preparing file context for stats submodule logger");
484  /* prepared by suricata-main */
485  stats_ctx->file_ctx = LogFileEnsureExists(0, ajt->file_ctx);
486  if (!stats_ctx->file_ctx) {
487  SCFree(stats_ctx);
488  SCFree(output_ctx);
489  return result;
490  }
491 
492  output_ctx->data = stats_ctx;
493  output_ctx->DeInit = OutputStatsLogDeinitSub;
494 
495  result.ctx = output_ctx;
496  result.ok = true;
497  return result;
498 }
499 
501  /* register as child of eve-log */
502  OutputRegisterStatsSubModule(LOGGER_JSON_STATS, "eve-log", MODULE_NAME, "eve-log.stats",
503  OutputStatsLogInitSub, JsonStatsLogger, JsonStatsLogThreadInit,
504  JsonStatsLogThreadDeinit);
505 }
506 
507 #ifdef UNITTESTS
508 #include "tests/output-json-stats.c"
509 #endif
tm-threads.h
StatsTable_::ntstats
uint32_t ntstats
Definition: output-stats.h:43
SCConfValIsTrue
int SCConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:577
detect-engine.h
offset
uint64_t offset
Definition: util-streaming-buffer.h:0
DetectEngineDeReference
void DetectEngineDeReference(DetectEngineCtx **de_ctx)
Definition: detect-engine.c:4943
CreateIsoTimeString
void CreateIsoTimeString(const SCTime_t ts, char *str, size_t size)
Definition: util-time.c:209
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
LOGGER_JSON_STATS
@ LOGGER_JSON_STATS
Definition: suricata-common.h:510
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
JSON_OUTPUT_BUFFER_SIZE
#define JSON_OUTPUT_BUFFER_SIZE
Definition: output-json.h:54
threads.h
JsonStatsLogThread
struct JsonStatsLogThread_ JsonStatsLogThread
OutputJsonCtx_
Definition: output-json.h:77
LogFileCtx_
Definition: util-logopenfile.h:77
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:995
output-json-stats.c
OutputRegisterStatsSubModule
void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, const char *name, const char *conf_name, OutputInitSubFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
Register a stats data output sub-module.
Definition: output.c:611
OutputStatsCtx_::flags
uint8_t flags
Definition: output-json-stats.c:66
DetectEngineGetCurrent
DetectEngineCtx * DetectEngineGetCurrent(void)
Definition: detect-engine.c:4142
SCConfValIsFalse
int SCConfValIsFalse(const char *val)
Check if a value is false.
Definition: conf.c:602
util-privs.h
SCConfNodeLookupChildValue
const char * SCConfNodeLookupChildValue(const SCConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:877
JSON_STATS_TOTALS
#define JSON_STATS_TOTALS
Definition: output-json-stats.h:29
StatsRecord_::pvalue
int64_t pvalue
Definition: output-stats.h:36
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:82
JsonStatsLogRegister
void JsonStatsLogRegister(void)
Definition: output-json-stats.c:500
OutputCtx_::data
void * data
Definition: tm-modules.h:91
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
OutputCtx_
Definition: tm-modules.h:88
strlcpy
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: util-strlcpyu.c:43
OutputEngineInfo_
OutputEngineInfo_
Definition: output-json-stats.c:58
stats_decoder_events_prefix
const char * stats_decoder_events_prefix
Definition: counters.c:97
SigFileLoaderStat_::skipped_sigs_total
int skipped_sigs_total
Definition: detect.h:912
util-debug.h
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:22
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:47
output-json.h
DetectEngineCtx_::last_reload
struct timeval last_reload
Definition: detect.h:1169
JsonStatsLogThread_::buffer
MemBuffer * buffer
Definition: output-json-stats.c:72
util-print.h
SCEnter
#define SCEnter(...)
Definition: util-debug.h:284
StatsRecord_::name
const char * name
Definition: output-stats.h:32
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
SCTIME_FROM_TIMEVAL
#define SCTIME_FROM_TIMEVAL(tv)
Definition: util-time.h:79
pkt-var.h
OutputInitResult_::ok
bool ok
Definition: output.h:48
SCLogWarning
#define SCLogWarning(...)
Macro used to log WARNING messages.
Definition: util-debug.h:262
ThreadVars_::id
int id
Definition: threadvars.h:85
SigFileLoaderStat_::bad_sigs_total
int bad_sigs_total
Definition: detect.h:911
OutputEngineStatsReloadTime
TmEcode OutputEngineStatsReloadTime(json_t **jdata)
Definition: output-json-stats.c:159
StatsTable_
Definition: output-stats.h:39
StatsRecord_::value
int64_t value
Definition: output-stats.h:35
StatsToJSON
json_t * StatsToJSON(const StatsTable *st, uint8_t flags)
turn StatsTable into a json object
Definition: output-json-stats.c:209
conf.h
SCTime_t
Definition: util-time.h:40
TmEcode
TmEcode
Definition: tm-threads-common.h:80
StatsTable_::start_time
time_t start_time
Definition: output-stats.h:44
MemBuffer_
Definition: util-buffer.h:27
JsonStatsLogThread_::file_ctx
LogFileCtx * file_ctx
Definition: output-json-stats.c:71
StatsTable_::stats
StatsRecord * stats
Definition: output-stats.h:40
JsonStatsLogThread_
Definition: output-json-stats.c:69
OutputInitResult_
Definition: output.h:46
DetectEngineCtx_::sig_stat
SigFileLoaderStat sig_stat
Definition: detect.h:1172
JSON_STATS_NO_ZEROES
#define JSON_STATS_NO_ZEROES
Definition: output-json-stats.h:32
flags
uint8_t flags
Definition: decode-gre.h:0
LogFileEnsureExists
LogFileCtx * LogFileEnsureExists(ThreadId thread_id, LogFileCtx *parent_ctx)
LogFileEnsureExists() Ensure a log file context for the thread exists.
Definition: util-logopenfile.c:786
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:94
output-json-stats.h
OUTPUT_ENGINE_LAST_RELOAD
@ OUTPUT_ENGINE_LAST_RELOAD
Definition: output-json-stats.c:59
DetectEngineCtx_::next
struct DetectEngineCtx_ * next
Definition: detect.h:1128
OUTPUT_ENGINE_ALL
@ OUTPUT_ENGINE_ALL
Definition: output-json-stats.c:61
MemBufferFree
void MemBufferFree(MemBuffer *buffer)
Definition: util-buffer.c:86
StatsEnabled
bool StatsEnabled(void)
Definition: counters.c:114
JSON_STATS_DELTAS
#define JSON_STATS_DELTAS
Definition: output-json-stats.h:31
StatsRecord_::tm_name
const char * tm_name
Definition: output-stats.h:34
JSON_STATS_THREADS
#define JSON_STATS_THREADS
Definition: output-json-stats.h:30
StatsTable_::tstats
StatsRecord * tstats
Definition: output-stats.h:41
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:34
threadvars.h
util-validate.h
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:274
SCFree
#define SCFree(p)
Definition: util-mem.h:61
SigFileLoaderStat_::good_sigs_total
int good_sigs_total
Definition: detect.h:910
util-logopenfile.h
util-buffer.h
StatsRecord_::short_name
const char * short_name
Definition: output-stats.h:33
OutputStatsCtx_::file_ctx
LogFileCtx * file_ctx
Definition: output-json-stats.c:65
OutputJsonCtx_::file_ctx
LogFileCtx * file_ctx
Definition: output-json.h:78
OutputJSONBuffer
int OutputJSONBuffer(json_t *js, LogFileCtx *file_ctx, MemBuffer **buffer)
Definition: output-json.c:989
OutputEngineInfo
enum OutputEngineInfo_ OutputEngineInfo
GetDocURL
const char * GetDocURL(void)
Definition: suricata.c:1216
OUTPUT_ENGINE_RULESET
@ OUTPUT_ENGINE_RULESET
Definition: output-json-stats.c:60
OutputEngineStatsRuleset
TmEcode OutputEngineStatsRuleset(json_t **jdata)
Definition: output-json-stats.c:163
JsonStatsLogThread_::statslog_ctx
OutputStatsCtx * statslog_ctx
Definition: output-json-stats.c:70
stats_decoder_events
bool stats_decoder_events
Definition: counters.c:96
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
MODULE_NAME
#define MODULE_NAME
Definition: output-json-stats.c:49
SCReturnInt
#define SCReturnInt(x)
Definition: util-debug.h:288
OutputStatsCtx
struct OutputStatsCtx_ OutputStatsCtx
SCConfNode_
Definition: conf.h:37
DetectEngineCtx_::tenant_id
uint32_t tenant_id
Definition: detect.h:1000
SigFileLoaderStat_
Signature loader statistics.
Definition: detect.h:906
StatsTable_::nstats
uint32_t nstats
Definition: output-stats.h:42
DEBUG_VALIDATE_BUG_ON
#define DEBUG_VALIDATE_BUG_ON(exp)
Definition: util-validate.h:109
MemBufferCreateNew
MemBuffer * MemBufferCreateNew(uint32_t size)
Definition: util-buffer.c:32
output.h
OutputStatsCtx_
Definition: output-json-stats.c:64