suricata
output-filestore.c
Go to the documentation of this file.
1 /* Copyright (C) 2018 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 #include "suricata-common.h"
19 
20 #include "app-layer-parser.h"
21 #include "app-layer-htp.h"
22 #include "app-layer-htp-xff.h"
23 #include "app-layer-smtp.h"
24 
25 #include "output.h"
26 #include "output-filestore.h"
27 #include "output-json-file.h"
28 
29 #include "util-print.h"
30 #include "util-misc.h"
31 
32 #ifdef HAVE_NSS
33 
34 #define MODULE_NAME "OutputFilestore"
35 
36 /* Create a filestore specific PATH_MAX that is less than the system
37  * PATH_MAX to prevent newer gcc truncation warnings with snprint. */
38 #define SHA256_STRING_LEN (SHA256_LENGTH * 2)
39 #define LEAF_DIR_MAX_LEN 4
40 #define FILESTORE_PREFIX_MAX (PATH_MAX - SHA256_STRING_LEN - LEAF_DIR_MAX_LEN)
41 
42 /* The default log directory, relative to the default log
43  * directory. */
44 static const char *default_log_dir = "filestore";
45 
46 /* Atomic counter of simultaneously open files. */
47 static SC_ATOMIC_DECLARE(uint32_t, filestore_open_file_cnt);
48 
49 typedef struct OutputFilestoreCtx_ {
50  char prefix[FILESTORE_PREFIX_MAX];
51  char tmpdir[FILESTORE_PREFIX_MAX];
52  bool fileinfo;
53  HttpXFFCfg *xff_cfg;
54 } OutputFilestoreCtx;
55 
56 typedef struct OutputFilestoreLogThread_ {
57  OutputFilestoreCtx *ctx;
58  uint16_t counter_max_hits;
59  uint16_t fs_error_counter;
60 } OutputFilestoreLogThread;
61 
62 /* For WARN_ONCE, a record of warnings that have already been
63  * issued. */
64 static __thread bool once_errs[SC_ERR_MAX];
65 
66 #define WARN_ONCE(err_code, ...) do { \
67  if (!once_errs[err_code]) { \
68  once_errs[err_code] = true; \
69  SCLogWarning(err_code, __VA_ARGS__); \
70  } \
71  } while (0)
72 
73 static uint64_t OutputFilestoreOpenFilesCounter(void)
74 {
75  return SC_ATOMIC_GET(filestore_open_file_cnt);
76 }
77 
78 static uint32_t g_file_store_max_open_files = 0;
79 
80 static void FileSetMaxOpenFiles(uint32_t count)
81 {
82  g_file_store_max_open_files = count;
83 }
84 
85 static uint32_t FileGetMaxOpenFiles(void)
86 {
87  return g_file_store_max_open_files;
88 }
89 
90 static void PrintHexString(char *str, size_t size, uint8_t *buf, size_t buf_len)
91 {
92  int i = 0;
93  size_t x = 0;
94  for (i = 0, x = 0; x < buf_len; x++) {
95  i += snprintf(&str[i], size - i, "%02x", buf[x]);
96  }
97 }
98 
99 /**
100  * \brief Update the timestamps on a file to match those of another
101  * file.
102  *
103  * \param src_filename Filename to use as timestamp source.
104  * \param filename Filename to apply timestamps to.
105  */
106 static void OutputFilestoreUpdateFileTime(const char *src_filename,
107  const char *filename)
108 {
109  struct stat sb;
110  if (stat(src_filename, &sb) != 0) {
111  SCLogDebug("Failed to stat %s: %s", filename, strerror(errno));
112  return;
113  }
114  struct utimbuf utimbuf = {
115  .actime = sb.st_atime,
116  .modtime = sb.st_mtime,
117  };
118  if (utime(filename, &utimbuf) != 0) {
119  SCLogDebug("Failed to update file timestamps: %s: %s", filename,
120  strerror(errno));
121  }
122 }
123 
124 static void OutputFilestoreFinalizeFiles(ThreadVars *tv,
125  const OutputFilestoreLogThread *oft, const OutputFilestoreCtx *ctx,
126  const Packet *p, File *ff, uint8_t dir) {
127  /* Stringify the SHA256 which will be used in the final
128  * filename. */
129  char sha256string[(SHA256_LENGTH * 2) + 1];
130  PrintHexString(sha256string, sizeof(sha256string), ff->sha256,
131  sizeof(ff->sha256));
132 
133  char tmp_filename[PATH_MAX] = "";
134  snprintf(tmp_filename, sizeof(tmp_filename), "%s/file.%u", ctx->tmpdir,
135  ff->file_store_id);
136 
137  char final_filename[PATH_MAX] = "";
138  snprintf(final_filename, sizeof(final_filename), "%s/%c%c/%s",
139  ctx->prefix, sha256string[0], sha256string[1], sha256string);
140 
141  if (SCPathExists(final_filename)) {
142  OutputFilestoreUpdateFileTime(tmp_filename, final_filename);
143  if (unlink(tmp_filename) != 0) {
144  StatsIncr(tv, oft->fs_error_counter);
145  WARN_ONCE(SC_WARN_REMOVE_FILE,
146  "Failed to remove temporary file %s: %s", tmp_filename,
147  strerror(errno));
148  }
149  } else if (rename(tmp_filename, final_filename) != 0) {
150  StatsIncr(tv, oft->fs_error_counter);
151  WARN_ONCE(SC_WARN_RENAMING_FILE, "Failed to rename %s to %s: %s",
152  tmp_filename, final_filename, strerror(errno));
153  if (unlink(tmp_filename) != 0) {
154  /* Just increment, don't log as has_fs_errors would
155  * already be set above. */
156  StatsIncr(tv, oft->fs_error_counter);
157  }
158  return;
159  }
160 
161  if (ctx->fileinfo) {
162  char js_metadata_filename[PATH_MAX];
163  if (snprintf(js_metadata_filename, sizeof(js_metadata_filename),
164  "%s.%"PRIuMAX".%u.json", final_filename,
165  (uintmax_t)p->ts.tv_sec, ff->file_store_id)
166  == (int)sizeof(js_metadata_filename)) {
167  WARN_ONCE(SC_ERR_SPRINTF,
168  "Failed to write file info record. Output filename truncated.");
169  } else {
170  json_t *js_fileinfo = JsonBuildFileInfoRecord(p, ff, true, dir,
171  ctx->xff_cfg);
172  if (likely(js_fileinfo != NULL)) {
173  json_dump_file(js_fileinfo, js_metadata_filename, 0);
174  json_decref(js_fileinfo);
175  }
176  }
177  }
178 }
179 
180 static int OutputFilestoreLogger(ThreadVars *tv, void *thread_data,
181  const Packet *p, File *ff, const uint8_t *data, uint32_t data_len,
182  uint8_t flags, uint8_t dir)
183 {
184  SCEnter();
185  OutputFilestoreLogThread *aft = (OutputFilestoreLogThread *)thread_data;
186  OutputFilestoreCtx *ctx = aft->ctx;
187  char filename[PATH_MAX] = "";
188  int file_fd = -1;
189 
190  /* no flow, no files */
191  if (p->flow == NULL) {
193  }
194 
195  if (!(PKT_IS_IPV4(p) || PKT_IS_IPV6(p))) {
196  return 0;
197  }
198 
199  SCLogDebug("ff %p, data %p, data_len %u", ff, data, data_len);
200 
201  char base_filename[PATH_MAX] = "";
202  snprintf(base_filename, sizeof(base_filename), "%s/file.%u",
203  ctx->tmpdir, ff->file_store_id);
204  snprintf(filename, sizeof(filename), "%s", base_filename);
205 
206  if (flags & OUTPUT_FILEDATA_FLAG_OPEN) {
207  file_fd = open(filename, O_CREAT | O_TRUNC | O_NOFOLLOW | O_WRONLY,
208  0644);
209  if (file_fd == -1) {
210  StatsIncr(tv, aft->fs_error_counter);
212  "Filestore (v2) failed to create %s: %s", filename,
213  strerror(errno));
214  return -1;
215  }
216 
217  if (SC_ATOMIC_GET(filestore_open_file_cnt) < FileGetMaxOpenFiles()) {
218  SC_ATOMIC_ADD(filestore_open_file_cnt, 1);
219  ff->fd = file_fd;
220  } else {
221  if (FileGetMaxOpenFiles() > 0) {
222  StatsIncr(tv, aft->counter_max_hits);
223  }
224  ff->fd = -1;
225  }
226  /* we can get called with a NULL ffd when we need to close */
227  } else if (data != NULL) {
228  if (ff->fd == -1) {
229  file_fd = open(filename, O_APPEND | O_NOFOLLOW | O_WRONLY);
230  if (file_fd == -1) {
231  StatsIncr(tv, aft->fs_error_counter);
232  WARN_ONCE(SC_ERR_OPENING_FILE,
233  "Filestore (v2) failed to open file %s: %s",
234  filename, strerror(errno));
235  return -1;
236  }
237  } else {
238  file_fd = ff->fd;
239  }
240  }
241 
242  if (file_fd != -1) {
243  ssize_t r = write(file_fd, (const void *)data, (size_t)data_len);
244  if (r == -1) {
245  StatsIncr(tv, aft->fs_error_counter);
246  WARN_ONCE(SC_ERR_FWRITE,
247  "Filestore (v2) failed to write to %s: %s",
248  filename, strerror(errno));
249  if (ff->fd != -1) {
250  SC_ATOMIC_SUB(filestore_open_file_cnt, 1);
251  }
252  ff->fd = -1;
253  }
254  if (ff->fd == -1) {
255  close(file_fd);
256  }
257  }
258 
259  if (flags & OUTPUT_FILEDATA_FLAG_CLOSE) {
260  if (ff->fd != -1) {
261  close(ff->fd);
262  ff->fd = -1;
263  SC_ATOMIC_SUB(filestore_open_file_cnt, 1);
264  }
265  OutputFilestoreFinalizeFiles(tv, aft, ctx, p, ff, dir);
266  }
267 
268  return 0;
269 }
270 
271 static TmEcode OutputFilestoreLogThreadInit(ThreadVars *t, const void *initdata,
272  void **data)
273 {
274  OutputFilestoreLogThread *aft = SCMalloc(sizeof(OutputFilestoreLogThread));
275  if (unlikely(aft == NULL))
276  return TM_ECODE_FAILED;
277  memset(aft, 0, sizeof(OutputFilestoreLogThread));
278 
279  if (initdata == NULL) {
280  SCLogDebug("Error getting context for LogFileStore. \"initdata\" argument NULL");
281  SCFree(aft);
282  return TM_ECODE_FAILED;
283  }
284 
285  OutputFilestoreCtx *ctx = ((OutputCtx *)initdata)->data;
286  aft->ctx = ctx;
287 
288  aft->counter_max_hits =
289  StatsRegisterCounter("file_store.open_files_max_hit", t);
290 
291  /* File system type errors (open, write, rename) will only be
292  * logged once. But this stat will be incremented for every
293  * occurence. */
294  aft->fs_error_counter = StatsRegisterCounter("file_store.fs_errors", t);
295 
296  *data = (void *)aft;
297  return TM_ECODE_OK;
298 }
299 
300 static TmEcode OutputFilestoreLogThreadDeinit(ThreadVars *t, void *data)
301 {
302  OutputFilestoreLogThread *aft = (OutputFilestoreLogThread *)data;
303  if (aft == NULL) {
304  return TM_ECODE_OK;
305  }
306 
307  /* clear memory */
308  memset(aft, 0, sizeof(OutputFilestoreLogThread));
309 
310  SCFree(aft);
311  return TM_ECODE_OK;
312 }
313 
314 static void OutputFilestoreLogDeInitCtx(OutputCtx *output_ctx)
315 {
316  OutputFilestoreCtx *ctx = (OutputFilestoreCtx *)output_ctx->data;
317  if (ctx->xff_cfg != NULL) {
318  SCFree(ctx->xff_cfg);
319  }
320  SCFree(ctx);
321  SCFree(output_ctx);
322 }
323 
324 static void GetLogDirectory(const ConfNode *conf, char *out, size_t out_size)
325 {
326  const char *log_base_dir = ConfNodeLookupChildValue(conf, "dir");
327  if (log_base_dir == NULL) {
328  SCLogConfig("Filestore (v2) default log directory %s", default_log_dir);
329  log_base_dir = default_log_dir;
330  }
331  if (PathIsAbsolute(log_base_dir)) {
332  strlcpy(out, log_base_dir, out_size);
333  } else {
334  const char *default_log_prefix = ConfigGetLogDirectory();
335  snprintf(out, out_size, "%s/%s", default_log_prefix, log_base_dir);
336  }
337 }
338 
339 static bool InitFilestoreDirectory(const char *dir)
340 {
341  const uint8_t dir_count = 0xff;
342 
343  if (!SCPathExists(dir)) {
344  SCLogInfo("Filestore (v2) creating directory %s", dir);
345  if (SCCreateDirectoryTree(dir, true) != 0) {
347  "Filestore (v2) failed to create directory %s: %s", dir,
348  strerror(errno));
349  return false;
350  }
351  }
352 
353  for (int i = 0; i <= dir_count; i++) {
354  char leaf[PATH_MAX];
355  int n = snprintf(leaf, sizeof(leaf), "%s/%02x", dir, i);
356  if (n < 0 || n >= PATH_MAX) {
358  "Filestore (v2) failed to create leaf directory: "
359  "path too long");
360  return false;
361  }
362  if (!SCPathExists(leaf)) {
363  SCLogInfo("Filestore (v2) creating directory %s", leaf);
364  if (SCDefaultMkDir(leaf) != 0) {
366  "Filestore (v2) failed to create directory %s: %s",
367  leaf, strerror(errno));
368  return false;
369  }
370  }
371  }
372 
373  /* Make sure the tmp directory exists. */
374  char tmpdir[PATH_MAX];
375  int n = snprintf(tmpdir, sizeof(tmpdir), "%s/tmp", dir);
376  if (n < 0 || n >= PATH_MAX) {
378  "Filestore (v2) failed to create tmp directory: path too long");
379  return false;
380  }
381  if (!SCPathExists(tmpdir)) {
382  SCLogInfo("Filestore (v2) creating directory %s", tmpdir);
383  if (SCDefaultMkDir(tmpdir) != 0) {
385  "Filestore (v2) failed to create directory %s: %s", tmpdir,
386  strerror(errno));
387  return false;
388  }
389  }
390 
391  return true;
392 }
393 
394 /** \brief Create a new http log OutputFilestoreCtx.
395  * \param conf Pointer to ConfNode containing this loggers configuration.
396  * \return NULL if failure, OutputFilestoreCtx* to the file_ctx if succesful
397  * */
398 static OutputInitResult OutputFilestoreLogInitCtx(ConfNode *conf)
399 {
400  OutputInitResult result = { NULL, false };
401 
402  intmax_t version = 0;
403  if (!ConfGetChildValueInt(conf, "version", &version) || version < 2) {
404  result.ok = true;
405  return result;
406  }
407 
410  "A file data logger is already enabled. Filestore (v2) "
411  "will not be enabled.");
412  return result;
413  }
414 
415  char log_directory[PATH_MAX] = "";
416  GetLogDirectory(conf, log_directory, sizeof(log_directory));
417  if (!InitFilestoreDirectory(log_directory)) {
418  return result;
419  }
420 
421  OutputFilestoreCtx *ctx = SCCalloc(1, sizeof(*ctx));
422  if (unlikely(ctx == NULL)) {
423  return result;
424  }
425 
426  strlcpy(ctx->prefix, log_directory, sizeof(ctx->prefix));
427  int written = snprintf(ctx->tmpdir, sizeof(ctx->tmpdir) - 1, "%s/tmp",
428  log_directory);
429  if (written == sizeof(ctx->tmpdir)) {
430  SCLogError(SC_ERR_SPRINTF, "File-store output directory overflow.");
431  SCFree(ctx);
432  return result;
433  }
434 
435  ctx->xff_cfg = SCCalloc(1, sizeof(HttpXFFCfg));
436  if (ctx->xff_cfg != NULL) {
437  HttpXFFGetCfg(conf, ctx->xff_cfg);
438  }
439 
440  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
441  if (unlikely(output_ctx == NULL)) {
442  SCFree(ctx);
443  return result;
444  }
445 
446  output_ctx->data = ctx;
447  output_ctx->DeInit = OutputFilestoreLogDeInitCtx;
448 
449  const char *write_fileinfo = ConfNodeLookupChildValue(conf,
450  "write-fileinfo");
451  if (write_fileinfo != NULL && ConfValIsTrue(write_fileinfo)) {
452  SCLogConfig("Filestore (v2) will output fileinfo records.");
453  ctx->fileinfo = true;
454  }
455 
456  const char *force_filestore = ConfNodeLookupChildValue(conf,
457  "force-filestore");
458  if (force_filestore != NULL && ConfValIsTrue(force_filestore)) {
460  SCLogInfo("forcing filestore of all files");
461  }
462 
463  const char *force_magic = ConfNodeLookupChildValue(conf, "force-magic");
464  if (force_magic != NULL && ConfValIsTrue(force_magic)) {
466  SCLogConfig("Filestore (v2) forcing magic lookup for stored files");
467  }
468 
469  FileForceHashParseCfg(conf);
470 
471  /* The new filestore requires SHA256. */
473 
474  const char *stream_depth_str = ConfNodeLookupChildValue(conf,
475  "stream-depth");
476  if (stream_depth_str != NULL && strcmp(stream_depth_str, "no")) {
477  uint32_t stream_depth = 0;
478  if (ParseSizeStringU32(stream_depth_str,
479  &stream_depth) < 0) {
480  SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
481  "file-store.stream-depth "
482  "from conf file - %s. Killing engine",
483  stream_depth_str);
484  exit(EXIT_FAILURE);
485  } else {
486  FileReassemblyDepthEnable(stream_depth);
487  }
488  }
489 
490  const char *file_count_str = ConfNodeLookupChildValue(conf,
491  "max-open-files");
492  if (file_count_str != NULL) {
493  uint32_t file_count = 0;
494  if (ParseSizeStringU32(file_count_str,
495  &file_count) < 0) {
496  SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
497  "file-store.max-open-files "
498  "from conf file - %s. Killing engine",
499  stream_depth_str);
500  exit(EXIT_FAILURE);
501  } else {
502  if (file_count != 0) {
503  FileSetMaxOpenFiles(file_count);
504  SCLogConfig("Filestore (v2) will keep a max of %d "
505  "simultaneously open files", file_count);
506  }
507  }
508  }
509 
510  StatsRegisterGlobalCounter("file_store.open_files",
511  OutputFilestoreOpenFilesCounter);
512 
513  result.ctx = output_ctx;
514  result.ok = true;
515  SCReturnCT(result, "OutputInitResult");
516 }
517 
518 #endif /* HAVE_NSS */
519 
521 {
522 #ifdef HAVE_NSS
524  OutputFilestoreLogInitCtx, OutputFilestoreLogger,
525  OutputFilestoreLogThreadInit, OutputFilestoreLogThreadDeinit,
526  NULL);
527 
528  SC_ATOMIC_INIT(filestore_open_file_cnt);
529  SC_ATOMIC_SET(filestore_open_file_cnt, 0);
530 #endif
531 }
#define OUTPUT_FILEDATA_FLAG_CLOSE
uint16_t flags
#define SCLogDebug(...)
Definition: util-debug.h:335
struct Flow_ * flow
Definition: decode.h:445
#define SC_ATOMIC_DECLARE(type, name)
wrapper to declare an atomic variable including a (spin) lock to protect it.
Definition: util-atomic.h:56
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: util-strlcpyu.c:43
void HttpXFFGetCfg(ConfNode *conf, HttpXFFCfg *result)
Function to return XFF configuration from a configuration node.
#define unlikely(expr)
Definition: util-optimize.h:35
void OutputFilestoreRegister(void)
#define SC_ATOMIC_ADD(name, val)
add a value to our atomic variable
Definition: util-atomic.h:107
#define PKT_IS_IPV6(p)
Definition: decode.h:252
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:84
#define SC_ATOMIC_SUB(name, val)
sub a value from our atomic variable
Definition: util-atomic.h:124
int fd
Definition: util-file.h:73
#define PKT_IS_IPV4(p)
Definition: decode.h:251
bool SCPathExists(const char *path)
Check if a path exists.
Definition: util-path.c:132
void FileReassemblyDepthEnable(uint32_t size)
Definition: util-file.c:116
#define SCReturnCT(x, type)
Definition: util-debug.h:351
json_t * JsonBuildFileInfoRecord(const Packet *p, const File *ff, const bool stored, uint8_t dir, HttpXFFCfg *xff_cfg)
uint16_t StatsRegisterCounter(const char *name, struct ThreadVars_ *tv)
Registers a normal, unqualified counter.
Definition: counters.c:931
#define O_NOFOLLOW
Definition: win32-misc.h:35
#define SC_ATOMIC_INIT(name)
Initialize the previously declared atomic variable and it&#39;s lock.
Definition: util-atomic.h:81
#define str(s)
#define SCCalloc(nm, a)
Definition: util-mem.h:253
const char * ConfNodeLookupChildValue(const ConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:843
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:294
void FileForceHashParseCfg(ConfNode *conf)
Function to parse forced file hashing configuration.
Definition: util-file.c:158
void FileForceMagicEnable(void)
Definition: util-file.c:91
#define SCEnter(...)
Definition: util-debug.h:337
#define MODULE_NAME
void FileForceFilestoreEnable(void)
Definition: util-file.c:86
void StatsIncr(ThreadVars *tv, uint16_t id)
Increments the local counter.
Definition: counters.c:163
int PathIsAbsolute(const char *path)
Check if a path is absolute.
Definition: util-path.c:39
uint16_t StatsRegisterGlobalCounter(const char *name, uint64_t(*Func)(void))
Registers a counter, which represents a global value.
Definition: counters.c:989
#define SCReturnInt(x)
Definition: util-debug.h:341
#define SCLogWarning(err_code,...)
Macro used to log WARNING messages.
Definition: util-debug.h:281
int ConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:566
Definition: conf.h:32
OutputCtx * ctx
Definition: output.h:42
const char * ConfigGetLogDirectory()
Definition: util-conf.c:36
#define SCMalloc(a)
Definition: util-mem.h:222
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
Definition: util-atomic.h:207
void FileForceSha256Enable(void)
Definition: util-file.c:106
int RunModeOutputFiledataEnabled(void)
Definition: runmodes.c:486
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
Definition: util-debug.h:254
uint8_t version
Definition: decode-gre.h:405
#define SCFree(a)
Definition: util-mem.h:322
void OutputRegisterFiledataModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, FiledataLogger FiledataLogFunc, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Register a file data output module.
Definition: output.c:499
void * data
Definition: tm-modules.h:81
#define SC_ATOMIC_GET(name)
Get the value from the atomic variable.
Definition: util-atomic.h:192
uint32_t file_store_id
Definition: util-file.h:72
int ConfGetChildValueInt(const ConfNode *base, const char *name, intmax_t *val)
Definition: conf.c:469
int SCCreateDirectoryTree(const char *path, const bool final)
Recursively create a directory.
Definition: util-path.c:86
Per thread variable structure.
Definition: threadvars.h:57
struct timeval ts
Definition: decode.h:451
int ParseSizeStringU32(const char *size, uint32_t *res)
Definition: util-misc.c:186
struct SCLogConfig_ SCLogConfig
Holds the config state used by the logging api.
#define likely(expr)
Definition: util-optimize.h:32
int SCDefaultMkDir(const char *path)
Wrapper around SCMkDir with default mode arguments.
Definition: util-path.c:72
#define OUTPUT_FILEDATA_FLAG_OPEN