Hello,

we found the logging of amavisd(-milter)? not as unique as it should be.
(MTA -> amavisd-milter -> amavisd) 

Nov 21 07:12:13 idvamavis03 amavisd-milter[4245]: 3dQ9R01QltzDP38: log_id=06573
Nov 21 07:12:55 idvamavis03 amavisd-milter[4245]: 3dQ9Rn2sGVzDP38: log_id=06573

# grep '(06573)' /var/log/mail | grep mail_id | wc -l
20

This is exactly $max_requests.

Digging into amavisd I found a function new_am_id responsible for id generation.
In miltermode it's called in line 19627 with a value of 'undef' which takes 
only the pid as log_id.

In Line 20234 new_am_id get $Amavis::child_invocation_count as additional 
parameter.

Atttached patch (amavisd-new-2.8.2-rc1) add $Amavis::child_invocation_count to 
the new_am_id
in miltermode and produces the expected logging:

Nov 21 05:19:53 taro amavisd-milter[11126]: 3dQ6xN2mnDz259S: log_id=28605-20
Nov 21 06:00:01 taro amavisd-milter[11126]: 3dQ7qb5sqJz259S: log_id=28606-20
Nov 21 06:11:39 taro amavisd-milter[11126]: 3dQ8521V0Xz259S: log_id=04856-01
Nov 21 06:31:00 taro amavisd-milter[11126]: 3dQ8WR1ZgDz259S: log_id=09749-01
Nov 21 06:32:00 taro amavisd-milter[11126]: 3dQ8Xc02WHz259S: log_id=04856-02

Any objections to solve the issue in an other way?
Andreas

-- 
Andreas Schulze
Internetdienste | P252

DATEV eG
90329 Nürnberg | Telefon +49 911 319-0 | Telefax +49 911 319-3196
E-Mail info @datev.de | Internet www.datev.de
Sitz: 90429 Nürnberg, Paumgartnerstr. 6-14 | Registergericht Nürnberg, GenReg 
Nr.70
Vorstand
Prof. Dieter Kempf (Vorsitzender)
Dipl.-Kfm. Wolfgang Stegmann (stellvertretender Vorsitzender)
Dipl.-Kfm. Michael Leistenschneider
Dipl.-Kfm. Dr. Robert Mayr
Jörg Rabe v. Pappenheim
Dipl.-Vw. Eckhard Schwarzer
Vorsitzender des Aufsichtsrates: Reinhard Verholen
Index: amavisd-new-2.8.2-rc1/amavisd
===================================================================
--- amavisd-new-2.8.2-rc1.orig/amavisd	2013-11-21 08:36:48.000000000 +0100
+++ amavisd-new-2.8.2-rc1/amavisd	2013-11-21 08:37:23.000000000 +0100
@@ -19624,7 +19624,7 @@
     } else {  # mail checking or releasing from a file
       do_log(5, "preprocess_policy_query: opening mail '%s'", $fname);
       # set new amavis message id
-      new_am_id( ($fname =~ m{amavis-(milter-)?([^/ \t]+)}s ? $2 : undef) )
+      new_am_id( ($fname =~ m{amavis-(milter-)?([^/ \t]+)}s ? $2 : undef), $Amavis::child_invocation_count)
         if !$releasing;
       # file created by amavis helper program or other client, just open it
       my(@stat_list) = lstat($fname); my $errn = @stat_list ? 0 : 0+$!;

Reply via email to