}
}
#endif
- else if (log_filetype == LOGFILE_TYPE_PLUGIN) {
+ else if (log_filetype == LOGFILE_TYPE_FILETYPE) {
if (json_ctx->file_ctx->threaded) {
/* Prepare for threaded log output. */
if (!SCLogOpenThreadedFile(NULL, NULL, json_ctx->file_ctx)) {
}
}
void *init_data = NULL;
- if (json_ctx->plugin->Init(conf, json_ctx->file_ctx->threaded, &init_data) < 0) {
+ if (json_ctx->filetype->Init(conf, json_ctx->file_ctx->threaded, &init_data) < 0) {
return -1;
}
- json_ctx->file_ctx->plugin.plugin = json_ctx->plugin;
- json_ctx->file_ctx->plugin.init_data = init_data;
+ json_ctx->file_ctx->filetype.filetype = json_ctx->filetype;
+ json_ctx->file_ctx->filetype.init_data = init_data;
}
return 0;
enum LogFileType log_filetype = FileTypeFromConf(output_s);
if (log_filetype == LOGFILE_TYPE_NOTSET) {
- SCEveFileType *plugin = SCEveFindFileType(output_s);
- if (plugin != NULL) {
- log_filetype = LOGFILE_TYPE_PLUGIN;
- json_ctx->plugin = plugin;
+ SCEveFileType *filetype = SCEveFindFileType(output_s);
+ if (filetype != NULL) {
+ log_filetype = LOGFILE_TYPE_FILETYPE;
+ json_ctx->filetype = filetype;
} else
FatalError("Invalid JSON output option: %s", output_s);
}
thread->Write = SCLogFileWriteNoLock;
thread->Close = SCLogFileCloseNoLock;
OutputRegisterFileRotationFlag(&thread->rotation_flag);
- } else if (parent_ctx->type == LOGFILE_TYPE_PLUGIN) {
+ } else if (parent_ctx->type == LOGFILE_TYPE_FILETYPE) {
entry->slot_number = SC_ATOMIC_ADD(eve_file_id, 1);
SCLogDebug("%s - thread %d [slot %d]", log_path, entry->internal_thread_id,
entry->slot_number);
- thread->plugin.plugin->ThreadInit(
- thread->plugin.init_data, entry->internal_thread_id, &thread->plugin.thread_data);
+ thread->filetype.filetype->ThreadInit(thread->filetype.init_data, entry->internal_thread_id,
+ &thread->filetype.thread_data);
}
thread->threaded = false;
thread->parent = parent_ctx;
SCReturnInt(0);
}
- if (lf_ctx->type == LOGFILE_TYPE_PLUGIN && lf_ctx->parent != NULL) {
- lf_ctx->plugin.plugin->ThreadDeinit(lf_ctx->plugin.init_data, lf_ctx->plugin.thread_data);
+ if (lf_ctx->type == LOGFILE_TYPE_FILETYPE && lf_ctx->parent != NULL) {
+ lf_ctx->filetype.filetype->ThreadDeinit(
+ lf_ctx->filetype.init_data, lf_ctx->filetype.thread_data);
}
if (lf_ctx->threaded) {
}
SCFree(lf_ctx->threads);
} else {
- if (lf_ctx->type != LOGFILE_TYPE_PLUGIN) {
+ if (lf_ctx->type != LOGFILE_TYPE_FILETYPE) {
if (lf_ctx->fp != NULL) {
lf_ctx->Close(lf_ctx);
}
OutputUnregisterFileRotationFlag(&lf_ctx->rotation_flag);
}
- /* Deinitialize output plugins. We only want to call this for the
- * parent of threaded output, or always for non-threaded
+ /* Deinitialize output filetypes. We only want to call this for
+ * the parent of threaded output, or always for non-threaded
* output. */
- if (lf_ctx->type == LOGFILE_TYPE_PLUGIN && lf_ctx->parent == NULL) {
- lf_ctx->plugin.plugin->Deinit(lf_ctx->plugin.init_data);
+ if (lf_ctx->type == LOGFILE_TYPE_FILETYPE && lf_ctx->parent == NULL) {
+ lf_ctx->filetype.filetype->Deinit(lf_ctx->filetype.init_data);
}
memset(lf_ctx, 0, sizeof(*lf_ctx));
MemBufferWriteString(buffer, "\n");
file_ctx->Write((const char *)MEMBUFFER_BUFFER(buffer),
MEMBUFFER_OFFSET(buffer), file_ctx);
- } else if (file_ctx->type == LOGFILE_TYPE_PLUGIN) {
- file_ctx->plugin.plugin->Write((const char *)MEMBUFFER_BUFFER(buffer),
- MEMBUFFER_OFFSET(buffer), file_ctx->plugin.init_data, file_ctx->plugin.thread_data);
+ } else if (file_ctx->type == LOGFILE_TYPE_FILETYPE) {
+ file_ctx->filetype.filetype->Write((const char *)MEMBUFFER_BUFFER(buffer),
+ MEMBUFFER_OFFSET(buffer), file_ctx->filetype.init_data,
+ file_ctx->filetype.thread_data);
}
#ifdef HAVE_LIBHIREDIS
else if (file_ctx->type == LOGFILE_TYPE_REDIS) {
#include "util-log-redis.h"
#endif /* HAVE_LIBHIREDIS */
-#include "suricata-plugin.h"
#include "output-eve.h"
enum LogFileType {
LOGFILE_TYPE_UNIX_DGRAM,
LOGFILE_TYPE_UNIX_STREAM,
LOGFILE_TYPE_REDIS,
- LOGFILE_TYPE_PLUGIN,
+ /** New style or modular filetypes. */
+ LOGFILE_TYPE_FILETYPE,
LOGFILE_TYPE_NOTSET
};
char *append;
} LogThreadedFileCtx;
-typedef struct LogFilePluginCtx_ {
- SCEveFileType *plugin;
+typedef struct LogFileTypeCtx_ {
+ SCEveFileType *filetype;
void *init_data;
void *thread_data;
-} LogFilePluginCtx;
+} LogFileTypeCtx;
/** Global structure for Output Context */
typedef struct LogFileCtx_ {
int (*Write)(const char *buffer, int buffer_len, struct LogFileCtx_ *fp);
void (*Close)(struct LogFileCtx_ *fp);
- LogFilePluginCtx plugin;
+ LogFileTypeCtx filetype;
/** It will be locked if the log/alert
* record cannot be written to the file in one call */