Go to the documentation of this file.
83 for (
size_t i = 0; i < cf->
cf_n; ++i) {
135 if (np-p > 0 && np-p < 10){
136 long maxlen = strtol(p,NULL,10);
138 node->
maxlen = (uint32_t) maxlen;
160 node->
data[0] =
'\0';
185 if (cf == NULL || node == NULL)
194 SCLogDebug(
"%d-> n.type=[%d] n.maxlen=[%d] n.data=[%s]",
211 time_t time =
ts->tv_sec;
213 struct tm *timestamp =
SCLocalTime(time, &local_tm);
217 if (fmt && *fmt !=
'\0') {
223 buffer->
size, (uint8_t *)buf,strlen(buf));
231 static int LogCustomFormatTest01(
void)
243 time_t secs = mktime(&tm);
244 struct timeval
ts = {secs, 0};
256 FAIL_IF(strcmp((
char *)buffer->
buffer,
"01/13/14-04:30:00") != 0);
263 static void LogCustomFormatRegisterTests(
void)
272 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)
LogCustomFormat * LogCustomFormatAlloc()
Creates a custom format.
void LogCustomFormatRegister(void)
@ SC_WARN_LOG_CF_TOO_MANY_NODES
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
size_t strlcpy(char *dst, const char *src, size_t siz)
struct tm * SCLocalTime(time_t timep, struct tm *result)
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
void MemBufferFree(MemBuffer *buffer)
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
void LogCustomFormatNodeFree(LogCustomFormatNode *node)
Frees memory held by a custom format node.
LogCustomFormatNode * LogCustomFormatNodeAlloc()
Creates a custom format node.
#define SCLogWarning(err_code,...)
Macro used to log WARNING messages.
void LogCustomFormatAddNode(LogCustomFormat *cf, LogCustomFormatNode *node)
Adds a node to custom format.
void PrintRawUriBuf(char *retbuf, uint32_t *offset, uint32_t retbuflen, uint8_t *buf, uint32_t buflen)
void LogCustomFormatWriteTimestamp(MemBuffer *buffer, const char *fmt, const struct timeval *ts)
Writes a timestamp with given format into a MemBuffer.
#define TIMESTAMP_DEFAULT_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.