aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-06 15:48:41 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-06 15:48:41 +0000
commitde867f0152419cadac174e8420ee153c8611c6a5 (patch)
treed0c7400e36b922a1ecf55745655e4b2d6e030ff3 /doc
parent568937a7d711f0082533b0b19fbf19a792438443 (diff)
downloadrspamd-de867f0152419cadac174e8420ee153c8611c6a5.tar.gz
rspamd-de867f0152419cadac174e8420ee153c8611c6a5.zip
Document log_format
Diffstat (limited to 'doc')
-rw-r--r--doc/markdown/configuration/logging.md41
1 files changed, 41 insertions, 0 deletions
diff --git a/doc/markdown/configuration/logging.md b/doc/markdown/configuration/logging.md
index 3493fc82c..373defa99 100644
--- a/doc/markdown/configuration/logging.md
+++ b/doc/markdown/configuration/logging.md
@@ -47,3 +47,44 @@ Here is summary of logging parameters:
+ `dns` - messages from DNS resolver
+ `map` - messages from maps in rspamd
+ `logger` - messages from the logger itself
+
+### Log format
+
+Rspamd supports custom log format when writing information about a message to log. This feature is supported since 1.1. The format string
+looks as following:
+
+
+ log_format =<< EOD
+ id: <$mid>,$if_qid{ qid: <$>,}$if_ip{ ip: $,}$if_user{ user: $,}$if_smtp_from{ from: <$>,}
+ (default: $is_spam ($action): [$scores] [$symbols]),
+ len: $len, time: $time_real real,
+ $time_virtual virtual, dns req: $dns_req
+ EOD
+
+Newlines are replaced with spaces. Both text and variables are supported in the log format line. Each variable can have the optional
+`if_` prefix when it should be printed if the specified component in the task is presented. Moreover, each variable can have optional body,
+where dollar sign is replaced with variable value (as many times as it is found in body, e.g. `$var{$$$$}` will be replaced with variable's name repeated 4 times).
+
+Rspamd supports the following variables:
+
+- `mid` - message id
+- `qid` - queue id
+- `ip` - from IP
+- `user` - authenticated user
+- `smtp_from` - envelope from (or MIME from if SMTP from is absent)
+- `mime_from` - MIME from
+- `len` - length of essage
+- `is_spam` - one letter of spammines: `T` for spam, `F` for ham and `S` for skipped messages
+- `action` - default metric action
+- `symbols` - list of all symbols
+- `time_real` - real time of task processing
+- `time_virtual` - CPU time of task processing
+- `dns_req` - number of DNS requests
+- `lua` - custom lua script, e.g:
+
+~~~lua
+ $lua{
+ return function(task)
+ return 'text parts: ' .. tostring(#task:get_text_parts()) end
+ }
+~~~