log file: add type flag

It will be used to store if the file is syslog or a real file.
pull/1502/head
Eric Leblond 10 years ago committed by Victor Julien
parent 7d73db9b80
commit 636e3d93c0

@ -39,10 +39,7 @@ TmEcode OutputJSON(json_t *js, void *data, uint64_t *count);
int OutputJSONBuffer(json_t *js, LogFileCtx *file_ctx, MemBuffer *buffer); int OutputJSONBuffer(json_t *js, LogFileCtx *file_ctx, MemBuffer *buffer);
OutputCtx *OutputJsonInitCtx(ConfNode *); OutputCtx *OutputJsonInitCtx(ConfNode *);
enum JsonOutput { ALERT_FILE,
ALERT_SYSLOG,
ALERT_UNIX_DGRAM,
ALERT_UNIX_STREAM };
enum JsonFormat { COMPACT, INDENT }; enum JsonFormat { COMPACT, INDENT };
/* /*
@ -50,11 +47,10 @@ enum JsonFormat { COMPACT, INDENT };
*/ */
typedef struct OutputJsonCtx_ { typedef struct OutputJsonCtx_ {
LogFileCtx *file_ctx; LogFileCtx *file_ctx;
enum JsonOutput json_out; enum LogFileType json_out;
enum JsonFormat format; enum JsonFormat format;
} OutputJsonCtx; } OutputJsonCtx;
typedef struct AlertJsonThread_ { typedef struct AlertJsonThread_ {
/** LogFileCtx has the pointer to the file and a mutex to allow multithreading */ /** LogFileCtx has the pointer to the file and a mutex to allow multithreading */
LogFileCtx *file_ctx; LogFileCtx *file_ctx;

@ -31,6 +31,11 @@ typedef struct {
uint16_t fileno; uint16_t fileno;
} PcieFile; } PcieFile;
enum LogFileType { ALERT_FILE,
ALERT_SYSLOG,
ALERT_UNIX_DGRAM,
ALERT_UNIX_STREAM };
/** Global structure for Output Context */ /** Global structure for Output Context */
typedef struct LogFileCtx_ { typedef struct LogFileCtx_ {
union { union {
@ -45,6 +50,9 @@ typedef struct LogFileCtx_ {
* record cannot be written to the file in one call */ * record cannot be written to the file in one call */
SCMutex fp_mutex; SCMutex fp_mutex;
/** the type of file */
enum LogFileType type;
/** The name of the file */ /** The name of the file */
char *filename; char *filename;

Loading…
Cancel
Save