Go to the documentation of this file.
43 SCLogError(
"Failed to alloc custom format node");
85 for (
size_t i = 0; i < cf->
cf_n; ++i) {
126 n = (uint32_t)(np - p);
137 if (np-p > 0 && np-p < 10){
138 long maxlen = strtol(p,NULL,10);
140 node->
maxlen = (uint32_t) maxlen;
154 n = (uint32_t)(np - p);
162 node->
data[0] =
'\0';
187 if (cf == NULL || node == NULL)
196 SCLogDebug(
"%d-> n.type=[%d] n.maxlen=[%d] n.data=[%s]",
216 struct tm *timestamp =
SCLocalTime(time, &local_tm);
220 if (fmt && *fmt !=
'\0') {
226 buffer->
size, (uint8_t *)buf,strlen(buf));
234 static int LogCustomFormatTest01(
void)
258 FAIL_IF(strcmp((
char *)buffer->
buffer,
"01/13/14-04:30:00") != 0);
265 static void LogCustomFormatRegisterTests(
void)
274 LogCustomFormatRegisterTests();
void LogCustomFormatFree(LogCustomFormat *cf)
Frees memory held by a custom format.
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
void CreateFormattedTimeString(const struct tm *t, const char *fmt, char *str, size_t size)
void LogCustomFormatRegister(void)
void LogCustomFormatWriteTimestamp(MemBuffer *buffer, const char *fmt, const SCTime_t ts)
Writes a timestamp with given format into a MemBuffer.
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
size_t strlcpy(char *dst, const char *src, size_t siz)
#define SCTIME_FROM_SECS(s)
#define SCLogWarning(...)
Macro used to log WARNING messages.
struct tm * SCLocalTime(time_t timep, struct tm *result)
void PrintRawUriBuf(char *retbuf, uint32_t *offset, uint32_t retbuflen, uint8_t *buf, size_t buflen)
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
void MemBufferFree(MemBuffer *buffer)
void LogCustomFormatNodeFree(LogCustomFormatNode *node)
Frees memory held by a custom format node.
#define SCLogError(...)
Macro used to log ERROR messages.
void LogCustomFormatAddNode(LogCustomFormat *cf, LogCustomFormatNode *node)
Adds a node to custom format.
#define TIMESTAMP_DEFAULT_FORMAT
LogCustomFormat * LogCustomFormatAlloc(void)
Creates a custom format.
#define LOG_NODE_MAXOUTPUTLEN
MemBuffer * MemBufferCreateNew(uint32_t size)
int LogCustomFormatParse(LogCustomFormat *cf, const char *format)
Parses and saves format nodes for custom format.
LogCustomFormatNode * LogCustomFormatNodeAlloc(void)
Creates a custom format node.