aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libserver/cfg_file.h34
-rw-r--r--src/libserver/cfg_rcl.c5
-rw-r--r--src/libserver/cfg_utils.c6
3 files changed, 45 insertions, 0 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 5f1abe1b0..416053aba 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -165,6 +165,38 @@ struct rspamd_worker_conf {
ucl_object_t *options; /**< other worker's options */
};
+enum rspamd_log_format_type {
+ RSPAMD_LOG_STRING = 0,
+ RSPAMD_LOG_MID,
+ RSPAMD_LOG_QID,
+ RSPAMD_LOG_USER,
+ RSPAMD_LOG_ISSPAM,
+ RSPAMD_LOG_ACTION,
+ RSPAMD_LOG_SCORES,
+ RSPAMD_LOG_SYMBOLS,
+ RSPAMD_LOG_IP,
+ RSPAMD_LOG_DNS_REQ,
+ RSPAMD_LOG_SMTP_FROM,
+ RSPAMD_LOG_MIME_FROM,
+ RSPAMD_LOG_TIME_REAL,
+ RSPAMD_LOG_TIME_VIRTUAL,
+ RSPAMD_LOG_LUA
+};
+
+enum rspamd_log_format_flags {
+ RSPAMD_LOG_FLAG_DEFAULT = 0,
+ RSPAMD_LOG_FLAG_OPTIONAL = (1 << 0),
+ RSPAMD_LOG_FLAG_MIME_ALTERNATIVE = (1 << 1),
+ RSPAMD_LOG_FLAG_CONDITION = (1 << 2)
+};
+
+struct rspamd_log_format {
+ enum rspamd_log_format_type type;
+ guint flags;
+ gpointer data;
+ struct rspamd_log_format *prev, *next;
+};
+
/**
* Structure that stores all config data
*/
@@ -277,6 +309,8 @@ struct rspamd_config {
GList *classify_headers; /**< list of headers using for statistics */
struct module_s **compiled_modules; /**< list of compiled C modules */
struct worker_s **compiled_workers; /**< list of compiled C modules */
+ struct rspamd_log_format *log_format; /**< parsed log format */
+ gchar *log_format_str; /**< raw log format string */
};
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index b572fd59c..b42f2241c 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1254,6 +1254,11 @@ rspamd_rcl_config_init (void)
rspamd_rcl_parse_struct_string_list,
G_STRUCT_OFFSET (struct rspamd_config, debug_modules),
RSPAMD_CL_FLAG_STRING_LIST_HASH);
+ rspamd_rcl_add_default_handler (sub,
+ "log_format",
+ rspamd_rcl_parse_struct_string,
+ G_STRUCT_OFFSET (struct rspamd_config, log_format_str),
+ 0);
/**
* Options section
*/
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 1aae2c12d..bad00db8a 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -177,6 +177,12 @@ rspamd_config_defaults (struct rspamd_config *cfg)
cfg->min_word_len = DEFAULT_MIN_WORD;
cfg->dns_max_requests = 64;
cfg->history_rows = 200;
+
+ /* Default log line */
+ cfg->log_format_str = "id: <$mid>, $if_qid{qid: <$>,} $if_ip{ip: $,}"
+ "$if_ip{ip: $,} $if_from{from: <$>,} (default: $is_spam "
+ "($action): [$scores] [$symbols]), len: $len, time: $time_real real,"
+ " $time_virtual virtual, dns req: $dns_req";
}
void