id: <$mid>,$if_qid{ qid: <$>,}$if_ip{ ip: $,}$if_user{ user: $,}$if_smtp_from{ from: <$>,}
(default: $is_spam ($action): [$scores] [$symbols_scores_params]),
len: $len, time: $time_real real, $time_virtual virtual, dns req: $dns_req,
-digest: <$digest>$if_smtp_rcpts{, rcpts: <$>}$if_mime_rcpt{, mime_rcpt: <$>}
+digest: <$digest>$if_smtp_rcpts{, rcpts: <$>}$if_mime_rcpt{, mime_rcpt: <$>}$if_filename{, file: $}
EOD
rspamd_ftok_cstr_equal (&tok, "checksum", TRUE)) {
type = RSPAMD_LOG_DIGEST;
}
+ else if (rspamd_ftok_cstr_equal (&tok, "filename", TRUE)) {
+ type = RSPAMD_LOG_FILENAME;
+ }
else {
msg_err_config ("unknown log variable: %T", &tok);
return FALSE;
ret = TRUE;
}
break;
+ case RSPAMD_LOG_FILENAME:
+ if (task->msg.fpath) {
+ ret = TRUE;
+ }
+ break;
default:
ret = TRUE;
break;
rspamd_fstring_t *res = logbuf;
rspamd_ftok_t var = {.begin = NULL, .len = 0};
static gchar numbuf[64];
+ static const gchar undef[] = "undef";
switch (lf->type) {
/* String vars */
var.len = strlen (var.begin);
}
else {
- var.begin = "undef";
- var.len = 5;
+ var.begin = undef;
+ var.len = sizeof (undef) - 1;
}
break;
case RSPAMD_LOG_QID:
var.len = strlen (var.begin);
}
else {
- var.begin = "undef";
- var.len = 5;
+ var.begin = undef;
+ var.len = sizeof (undef) - 1;
}
break;
case RSPAMD_LOG_USER:
var.len = strlen (var.begin);
}
else {
- var.begin = "undef";
- var.len = 5;
+ var.begin = undef;
+ var.len = sizeof (undef) - 1;
}
break;
case RSPAMD_LOG_IP:
var.len = strlen (var.begin);
}
else {
- var.begin = "undef";
- var.len = 5;
+ var.begin = undef;
+ var.len = sizeof (undef) - 1;
}
break;
/* Numeric vars */
(gint)sizeof (task->digest), task->digest);
var.begin = numbuf;
break;
+ case RSPAMD_LOG_FILENAME:
+ if (task->msg.fpath) {
+ var.len = strlen (task->msg.fpath);
+ var.begin = task->msg.fpath;
+ }
+ else {
+ var.begin = undef;
+ var.len = sizeof (undef) - 1;
+ }
+ break;
default:
var = rspamd_task_log_metric_res (task, lf);
break;