|
|
|
@ -606,23 +606,25 @@ static int LogFileWriteRedis(LogFileCtx *file_ctx, char *string, size_t string_
|
|
|
|
|
|
|
|
|
|
int LogFileWrite(LogFileCtx *file_ctx, MemBuffer *buffer, char *string, size_t string_len)
|
|
|
|
|
{
|
|
|
|
|
SCMutexLock(&file_ctx->fp_mutex);
|
|
|
|
|
if (file_ctx->type == LOGFILE_TYPE_SYSLOG) {
|
|
|
|
|
syslog(file_ctx->syslog_setup.alert_syslog_level, "%s", string);
|
|
|
|
|
} else if (file_ctx->type == LOGFILE_TYPE_FILE ||
|
|
|
|
|
file_ctx->type == LOGFILE_TYPE_UNIX_DGRAM ||
|
|
|
|
|
file_ctx->type == LOGFILE_TYPE_UNIX_STREAM)
|
|
|
|
|
{
|
|
|
|
|
SCMutexLock(&file_ctx->fp_mutex);
|
|
|
|
|
MemBufferWriteString(buffer, "%s\n", string);
|
|
|
|
|
file_ctx->Write((const char *)MEMBUFFER_BUFFER(buffer),
|
|
|
|
|
MEMBUFFER_OFFSET(buffer), file_ctx);
|
|
|
|
|
SCMutexUnlock(&file_ctx->fp_mutex);
|
|
|
|
|
}
|
|
|
|
|
#ifdef HAVE_LIBHIREDIS
|
|
|
|
|
else if (file_ctx->type == LOGFILE_TYPE_REDIS) {
|
|
|
|
|
SCMutexLock(&file_ctx->fp_mutex);
|
|
|
|
|
LogFileWriteRedis(file_ctx, string, string_len);
|
|
|
|
|
SCMutexUnlock(&file_ctx->fp_mutex);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
SCMutexUnlock(&file_ctx->fp_mutex);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|