Mike,

> I use amavis on my mail server and I would like to sort my quarantine
> by day. For instance in my quarantine folder I will have :
> /var/virusmails/virus/20080828/EjboTNooM8NJ
> /var/virusmails/spam/20080828/zUGhZCNYkgJj.gz
>
> $QUARANTINEDIR = '/var/virusmails';
> $quarantine_subdir_levels = 0;
> $virus_quarantine_method        = 'local:virus/%m';
> $banned_files_quarantine_method = 'local:banned/%m';
> $spam_quarantine_method         = 'local:spam/%m.gz';
> $bad_header_quarantine_method   = 'local:badh/%m';

It is possible by using a %P template substitution as available since
amavisd-2.6.1.  From release notes:


- recognize an additional place-holder %P in a template used to build
  a file name in file-based quarantining, for example:

    $spam_quarantine_method = 'local:Week%P/spam/%m.gz';

  A %P is replaced by a current partition tag, which makes it easier to
  better organize a file-based quarantine by including a partition tag
  (e.g. an ISO week number) in a file name or a file path.

  For the record, here is a complete list of place-holders currently
  recognized in filename templates:
    %P  =>  $msginfo->partition_tag
    %b  =>  $msginfo->body_digest
    %m  =>  $msginfo->mail_id
    %n  =>  $msginfo->log_id
    %i  =>  iso8601 timestamp of a message reception time by amavisd
    %%  =>  %

  The following example organizes spam quarantine into weekly
  subdirectories:
    cd /var/virusmails
    mkdir -p W23/spam W24/spam W25/spam  ... (weeks 01..53)
    chown -R vscan:vscan W23 W24 W25     ... (weeks 01..53)
  amavisd.conf:
    $spam_quarantine_method = 'local:W%P/spam/%m.gz';
    $sql_partition_tag =
      sub { my($msginfo)[EMAIL PROTECTED];
            sprintf("%02d",iso8601_week($msginfo->rx_time)) };


In your case you'd want a date string instead of a week number,
so the following (in amavisd.conf) would do the trick:

  use POSIX qw(strftime);
  $sql_partition_tag =
    sub { my($msginfo)[EMAIL PROTECTED];
          strftime("%Y%m%d",localtime($msginfo->rx_time)) };

  $virus_quarantine_method        = 'local:virus/%P/%m';
  $banned_files_quarantine_method = 'local:banned/%P/%m';
  $spam_quarantine_method         = 'local:spam/%P/%m.gz';
  $bad_header_quarantine_method   = 'local:badh/%P/%m';


A caveat is that these subdirectories must exist, amavisd won't
create them for you. So you'd want to create ahead per-date
subfolders for some time ahead. Perhaps a nightly cron job would
be the right tool to prepare directories for the following day.

  Mark

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 
 AMaViS-HowTos:http://www.amavis.org/howto/ 

Reply via email to