aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libserver/cfg_file.h3
-rw-r--r--src/libserver/cfg_utils.c4
-rw-r--r--src/libserver/task.c7
3 files changed, 12 insertions, 2 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 005c3c984..f0e09f0b2 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -211,7 +211,8 @@ enum rspamd_log_format_type {
RSPAMD_LOG_MIME_RCPTS,
RSPAMD_LOG_TIME_REAL,
RSPAMD_LOG_TIME_VIRTUAL,
- RSPAMD_LOG_LUA
+ RSPAMD_LOG_LUA,
+ RSPAMD_LOG_DIGEST,
};
enum rspamd_log_format_flags {
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index d3bcfc03a..bb8acc33d 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -393,6 +393,10 @@ rspamd_config_process_var (struct rspamd_config *cfg, const rspamd_ftok_t *var,
else if (rspamd_ftok_cstr_equal (&tok, "lua", TRUE)) {
type = RSPAMD_LOG_LUA;
}
+ else if (rspamd_ftok_cstr_equal (&tok, "digest", TRUE) ||
+ rspamd_ftok_cstr_equal (&tok, "checksum", TRUE)) {
+ type = RSPAMD_LOG_DIGEST;
+ }
else {
msg_err_config ("unknown log variable: %T", &tok);
return FALSE;
diff --git a/src/libserver/task.c b/src/libserver/task.c
index 47e9aa1c5..70566b6b0 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -1123,7 +1123,7 @@ rspamd_task_log_variable (struct rspamd_task *task,
{
rspamd_fstring_t *res = logbuf;
rspamd_ftok_t var = {.begin = NULL, .len = 0};
- static gchar numbuf[32];
+ static gchar numbuf[64];
switch (lf->type) {
/* String vars */
@@ -1226,6 +1226,11 @@ rspamd_task_log_variable (struct rspamd_task *task,
logbuf);
}
break;
+ case RSPAMD_LOG_DIGEST:
+ var.len = rspamd_snprintf (numbuf, sizeof (numbuf), "%*xs",
+ (gint)sizeof (task->digest), task->digest);
+ var.begin = numbuf;
+ break;
default:
var = rspamd_task_log_metric_res (task, lf);
break;