get more details in JSON logs

Patrick Proniewski patrick.proniewski at univ-lyon2.fr
Sat Nov 2 16:36:13 CET 2019


> If you are logging via a $log_templ macro, this is not possible as far
> as I can tell. If you log into redis, this "config" snippet might work
> for you. No guarantees, though.
> 
>> package Amavis::Custom {
>>    use strict;
>>    use warnings;
>>    no warnings qw(uninitialized redefine);
>> 
>>    sub new { bless {}, shift }
>> 
>>    sub mail_done {
>> 
>>        return unless $Amavis::report_ref;
>> 
>>        my ($self, $conn, $msginfo) = @_;
>>        my $part;
>> 
>>        for (my(@unvisited)=($msginfo->parts_root);
>>             @unvisited and $part=shift(@unvisited);
>>             push(@unvisited,@{$part->children})
>>        ){
>>            if ($part->mime_placement and
>>                $part->mime_placement =~ '^\d+/\d+$' and
>>                $part->name_declared
>>            ){
>>                push @{$Amavis::report_ref->{file_names}}, $part->name_declared;
>>            }
>>        }
>>    }
>> }
>> 
>> 1;
> 


I'm using redis and I'm currently testing your config addon on my personal server, before pushing in prod at work: works great so far. Thanks a lot :)

Patrick


More information about the amavis-users mailing list