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
*/
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 */
};
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
*/
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