<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 19 Jul 2019 at 14:06, mabi <<a href="mailto:mabi@protonmail.ch">mabi@protonmail.ch</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
I would like to log the typical X-Spam-Status mail header which gets added by SpamAssassin to a mail into the amavis log file in order to track the rules and their scores which gets triggered by ham and spam mails.<br>
<br>
Is this somehow possible with Amavis?<br></blockquote><div><br></div><div style="font-size:small" class="gmail_default">The X-Spam-Status header is added by Amavis itself. With postfix (and postfix-pcre) you could log it thus (untested):</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">/etc/postfix/<a href="http://master.cf">master.cf</a>:</div><div style="font-size:small" class="gmail_default">...<br></div><div style="font-size:small" class="gmail_default"># this smtpd receives emails being re-injected into postfix by amavis</div><div style="font-size:small" class="gmail_default"><a href="http://127.0.0.1:10025">127.0.0.1:10025</a> inet n - y - - smtpd</div><div style="font-size:small" class="gmail_default">...</div><div style="font-size:small" class="gmail_default"> -o cleanup_service_name=cleanup_post_amavis</div><div style="font-size:small" class="gmail_default">...<br></div><div style="font-size:small" class="gmail_default">cleanup_post_amavis unix n - y - 0 cleanup</div><div style="font-size:small" class="gmail_default">...<br></div><div style="font-size:small" class="gmail_default"> -o header_checks=pcre:/etc/postfix/log_spam_status.pcre<br></div><div style="font-size:small" class="gmail_default">...</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">/etc/postfix/log_spam_status.pcre:</div><div style="font-size:small" class="gmail_default">/^(X-Spam-Status: .*)$/ INFO ${1}</div><div style="font-size:small" class="gmail_default"><br></div><div style="font-size:small" class="gmail_default">Note that due to a feature (bug?) any 'X-Spam-Status' line in a quarantined email is stripped out by Amavis when the email is released (using amavisd-release) and so will not be seen by postfix. My workaround is to rename any such header in the quarantined email before releasing it.<br></div></div></div>