[Rspamd-Users] custom mail info logging

Franta Hanzlík franta at hanzlici.cz
Mon Aug 7 04:07:41 UTC 2023


On Sun, 6 Aug 2023 20:26:55 +0200
Gerald Galster <list+rspamd at gcore.biz> wrote:

> > As mime_from/mime_rcpts? log variables logs only pure mail address and
> > there is no variable for Subject, I tried to use lua script.
> > Unfortunately I don't know anything about lua.
> > Now I have in /etc/rspamd/local.d/logging.inc something as:
> > 
> > log_format =<<EOD
> > ...
> > $lua{
> >  return function(task)
> >    return ' From:' .. task:get_header('From') .. ' To: ' .. task:get_header('To') .. ' Cc:' .. task:get_header('Cc') .. ' Subj:' .. task:get_header('Subject')
> >  end
> > }
> > ...
> > EOD  
> 
> Try tostring(task:get_header('Subject')) or tostring(task:get_subject()) etc.
> 
> Best regards,
> Gerald
> 
> -- 

It makes me a little nervous that I don't know why this is, but it works ;)
After wrapping the task:get_header() in tostring(), all values are written
out - and the string "nil" is printed instead of the missing ones.
Which I don't mind.
---
Again, big thanks!
Franta Hanzlik


More information about the Users mailing list