[Rspamd-Users] log mta ip (proxy/milter) with rspamd_task_write_log

Gerald Galster list+rspamd at gcore.biz
Mon Feb 3 21:21:35 UTC 2020


Hello,

is it possible to log the ip of the incoming MTA that connects to rspamd via proxy/milter with rspamd results (rspamd_task_write_log)?

I want to avoid parsing the log and correlating with rspamd_task_write_log entries, just to see where requests come from.
rspamd[22398]: <ad6474>; proxy; proxy_accept_socket: accepted milter connection from 1.2.3.4 port 37360

https://rspamd.com/doc/lua/rspamd_task.html#mc3cbf
Can I get the ip with task:get_session()/rspamd_session object?

Thanks
Gerald


local.d/logging.inc

log_format =<<EOD
id: <$mid>,$if_qid{ qid: <$>,}$if_ip{ ip: $,}$if_user{ user: $,}$if_smtp_from{ from: <$>,}
[...]
$lua{
        return function(task)
                return 'client_ip: ' .. tostring(task:get_client_ip())
        end
}
EOD



More information about the Users mailing list