suricata
|
#include "log-cf-common.h"
#include "util-print.h"
#include "util-unittest.h"
#include "util-time.h"
#include "util-debug.h"
Go to the source code of this file.
Functions | |
LogCustomFormatNode * | LogCustomFormatNodeAlloc (void) |
Creates a custom format node. More... | |
LogCustomFormat * | LogCustomFormatAlloc (void) |
Creates a custom format. More... | |
void | LogCustomFormatNodeFree (LogCustomFormatNode *node) |
Frees memory held by a custom format node. More... | |
void | LogCustomFormatFree (LogCustomFormat *cf) |
Frees memory held by a custom format. More... | |
int | LogCustomFormatParse (LogCustomFormat *cf, const char *format) |
Parses and saves format nodes for custom format. More... | |
void | LogCustomFormatAddNode (LogCustomFormat *cf, LogCustomFormatNode *node) |
Adds a node to custom format. More... | |
void | LogCustomFormatWriteTimestamp (MemBuffer *buffer, const char *fmt, const SCTime_t ts) |
Writes a timestamp with given format into a MemBuffer. More... | |
void | LogCustomFormatRegister (void) |
Common custom logging format
Definition in file log-cf-common.c.
void LogCustomFormatAddNode | ( | LogCustomFormat * | cf, |
LogCustomFormatNode * | node | ||
) |
Adds a node to custom format.
LogCustomFormat | * cf - custom format |
LogCustomFormatNode | * node - node to add |
Definition at line 185 of file log-cf-common.c.
References LogCustomFormat_::cf_n, LogCustomFormat_::cf_nodes, LogCustomFormatNode_::data, LOG_MAXN_NODES, LogCustomFormatNode_::maxlen, SCLogDebug, SCLogWarning, and LogCustomFormatNode_::type.
Referenced by LogCustomFormatParse().
LogCustomFormat* LogCustomFormatAlloc | ( | void | ) |
Creates a custom format.
LogCustomFormat | * ptr if created |
NULL | if failed to allocate |
Definition at line 54 of file log-cf-common.c.
References SCCalloc, SCLogError, and unlikely.
Referenced by LogHttpLogInitCtx().
void LogCustomFormatFree | ( | LogCustomFormat * | cf | ) |
Frees memory held by a custom format.
LogCustomFormat | * cf - format to release |
Definition at line 80 of file log-cf-common.c.
References LogCustomFormat_::cf_n, LogCustomFormat_::cf_nodes, LogCustomFormatNodeFree(), and SCFree.
LogCustomFormatNode* LogCustomFormatNodeAlloc | ( | void | ) |
Creates a custom format node.
LogCustomFormatNode | * ptr if created |
NULL | if failed to allocate |
Definition at line 39 of file log-cf-common.c.
References SCCalloc, SCLogError, and unlikely.
Referenced by LogCustomFormatParse().
void LogCustomFormatNodeFree | ( | LogCustomFormatNode * | node | ) |
Frees memory held by a custom format node.
LogCustomFormatNode | * node - node to release |
Definition at line 68 of file log-cf-common.c.
References SCFree.
Referenced by LogCustomFormatFree(), and LogCustomFormatParse().
int LogCustomFormatParse | ( | LogCustomFormat * | cf, |
const char * | format | ||
) |
Parses and saves format nodes for custom format.
LogCustomFormat | * cf - custom format to build |
const | char * format - string with format specification |
Definition at line 96 of file log-cf-common.c.
References LogCustomFormat_::cf_n, LogCustomFormatNode_::data, LOG_CF_LITERAL, LOG_MAXN_NODES, LOG_NODE_MAXOUTPUTLEN, LOG_NODE_STRLEN, LogCustomFormatAddNode(), LogCustomFormatNodeAlloc(), LogCustomFormatNodeFree(), LogCustomFormatNode_::maxlen, strlcpy(), and LogCustomFormatNode_::type.
Referenced by LogHttpLogInitCtx().
void LogCustomFormatRegister | ( | void | ) |
Definition at line 271 of file log-cf-common.c.
Referenced by OutputRegisterLoggers().
Writes a timestamp with given format into a MemBuffer.
MemBuffer | * buffer - where to write |
const | char * fmt - format to be used write timestamp |
const | struct timeveal *ts - the timestamp |
Definition at line 211 of file log-cf-common.c.
References MemBuffer_::buffer, CreateFormattedTimeString(), MemBuffer_::offset, PrintRawUriBuf(), SCLocalTime(), SCTIME_SECS, MemBuffer_::size, TIMESTAMP_DEFAULT_FORMAT, and ts.