Zothos do NOT commit it please. I've an svn account but this is not enough tested yet.
Bug: it doesn't work well if amavis is disabled (test cases 1-3 fail!)
Bug 2: when there are multiple forwarded recipients (amavis on), maillogconvert outputs n_forwarders -1 delivery lines, and all of them get counted with an added n_forwarders*size size, so you end up counting too much.
I added 6 more test cases. 3 of them use an address both@{dmn,sub.dmn,als}.tld, which are addresses that have both a local mailbox and a forward to me@external.dmn. The other 3 use an address multiple@{dmn,sub.dmn,als}.tld which are addresses forwarded (no mailbox) to 2 mails: me@external.dmn and other@external.dmn.
This is the output of maillogconvert.pl after running the total 12 test cases (each test case is separated with a blank line) on a sistem with amavis
enabled:
Code:
2008-06-19 08:17:10 me@external.dmn user@dmn.tld test.server.tld 127.0.0.1 SMTP - 1 778295
2008-06-19 08:17:10 me@external.dmn user@dmn.tld test.server.tld virtual SMTP - 1 778666
2008-06-19 08:17:19 me@external.dmn user@sub.dmn.tld test.server.tld 127.0.0.1 SMTP - 1 222777
2008-06-19 08:17:19 me@external.dmn user@sub.dmn.tld test.server.tld virtual SMTP - 1 223156
2008-06-19 08:17:27 me@external.dmn user@als.tld test.server.tld 127.0.0.1 SMTP - 1 225379
2008-06-19 08:17:27 me@external.dmn user@als.tld test.server.tld virtual SMTP - 1 225750
2008-06-19 08:17:35 me@external.dmn redir@dmn.tld test.server.tld 127.0.0.1 SMTP - 1 778303
2008-06-19 08:17:35 me@external.dmn me@external.dmn test.server.tld mx.external.dmn SMTP - 1 778674
2008-06-19 08:17:41 me@external.dmn redir@sub.dmn.tld test.server.tld 127.0.0.1 SMTP - 1 222785
2008-06-19 08:17:42 me@external.dmn me@external.dmn test.server.tld mx.external.dmn SMTP - 1 223156
2008-06-19 08:17:50 me@external.dmn redir@als.tld test.server.tld 127.0.0.1 SMTP - 1 225387
2008-06-19 08:17:51 me@external.dmn me@external.dmn test.server.tld mx.external.dmn SMTP - 1 225758
2008-06-19 08:18:00 me@external.dmn both@dmn.tld test.server.tld 127.0.0.1 SMTP - 1 778297
2008-06-19 08:18:01 me@external.dmn both@dmn.tld test.server.tld 127.0.0.1 SMTP - 1 778297
2008-06-19 08:18:01 me@external.dmn both@dmn.tld test.server.tld virtual SMTP - 1 778628
2008-06-19 08:18:01 me@external.dmn both@dmn.tld test.server.tld mx.external.dmn SMTP - 1 778628
2008-06-19 08:18:01 me@external.dmn me@external.dmn test.server.tld mx.external.dmn SMTP - 1 778628
2008-06-19 08:18:10 me@external.dmn both@sub.dmn.tld test.server.tld 127.0.0.1 SMTP - 1 222779
2008-06-19 08:18:10 me@external.dmn both@sub.dmn.tld test.server.tld 127.0.0.1 SMTP - 1 222779
2008-06-19 08:18:10 me@external.dmn me@external.dmn test.server.tld mx.external.dmn SMTP - 1 223110
2008-06-19 08:18:10 me@external.dmn both@sub.dmn.tld test.server.tld mx.external.dmn SMTP - 1 223110
2008-06-19 08:18:10 me@external.dmn both@sub.dmn.tld test.server.tld virtual SMTP - 1 223110
2008-06-19 08:18:35 me@external.dmn both@als.tld test.server.tld 127.0.0.1 SMTP - 1 225381
2008-06-19 08:18:35 me@external.dmn both@als.tld test.server.tld 127.0.0.1 SMTP - 1 225381
2008-06-19 08:18:35 me@external.dmn both@als.tld test.server.tld mx.external.dmn SMTP - 1 225712
2008-06-19 08:18:35 me@external.dmn me@external.dmn test.server.tld mx.external.dmn SMTP - 1 225712
2008-06-19 08:18:35 me@external.dmn both@als.tld test.server.tld virtual SMTP - 1 225712
2008-06-19 08:19:02 me@external.dmn multiple@dmn.tld test.server.tld 127.0.0.1 SMTP - 1 778323
2008-06-19 08:19:02 me@external.dmn multiple@dmn.tld test.server.tld 127.0.0.1 SMTP - 1 778323
2008-06-19 08:19:03 me@external.dmn other@external.dmn test.server.tld mx.external.dmn SMTP - 1 778654
2008-06-19 08:19:03 me@external.dmn me@external.dmn test.server.tld mx.external.dmn SMTP - 1 778654
2008-06-19 08:19:29 me@external.dmn multiple@sub.dmn.tld test.server.tld 127.0.0.1 SMTP - 1 222805
2008-06-19 08:19:29 me@external.dmn multiple@sub.dmn.tld test.server.tld 127.0.0.1 SMTP - 1 222805
2008-06-19 08:19:29 me@external.dmn other@external.dmn test.server.tld mx.external.dmn SMTP - 1 223136
2008-06-19 08:19:29 me@external.dmn me@external.dmn test.server.tld mx.external.dmn SMTP - 1 223136
2008-06-19 08:19:47 me@external.dmn multiple@als.tld test.server.tld 127.0.0.1 SMTP - 1 225407
2008-06-19 08:19:47 me@external.dmn multiple@als.tld test.server.tld 127.0.0.1 SMTP - 1 225407
2008-06-19 08:19:48 me@external.dmn other@external.dmn test.server.tld mx.external.dmn SMTP - 1 225738
2008-06-19 08:19:48 me@external.dmn me@external.dmn test.server.tld mx.external.dmn SMTP - 1 225738
And this is the output of running the exact same tests on a system with amavis
off:
Code:
2008-06-19 08:21:06 me@external.dmn user@dmn.tld test.server.tld virtual SMTP - 1 778297
2008-06-19 08:21:13 me@external.dmn user@sub.dmn.tld test.server.tld virtual SMTP - 1 222779
2008-06-19 08:21:18 me@external.dmn user@als.tld test.server.tld virtual SMTP - 1 225381
2008-06-19 08:21:26 me@external.dmn redir@dmn.tld test.server.tld mx.external.dmn SMTP - 1 778305
2008-06-19 08:21:33 me@external.dmn redir@sub.dmn.tld test.server.tld mx.external.dmn SMTP - 1 222787
2008-06-19 08:21:39 me@external.dmn redir@als.tld test.server.tld mx.external.dmn SMTP - 1 225389
2008-06-19 08:21:49 me@external.dmn both@dmn.tld test.server.tld mx.external.dmn SMTP - 1 778299
2008-06-19 08:21:49 me@external.dmn both@dmn.tld test.server.tld virtual SMTP - 1 778299
2008-06-19 08:21:55 me@external.dmn both@sub.dmn.tld test.server.tld virtual SMTP - 1 222781
2008-06-19 08:21:55 me@external.dmn both@sub.dmn.tld test.server.tld mx.external.dmn SMTP - 1 222781
2008-06-19 08:22:00 me@external.dmn both@als.tld test.server.tld virtual SMTP - 1 225383
2008-06-19 08:22:00 me@external.dmn both@als.tld test.server.tld mx.external.dmn SMTP - 1 225383
2008-06-19 08:22:08 me@external.dmn multiple@dmn.tld test.server.tld mx.external.dmn SMTP - 1 778325
2008-06-19 08:22:08 me@external.dmn multiple@dmn.tld test.server.tld mx.external.dmn SMTP - 1 778325
2008-06-19 08:22:17 me@external.dmn multiple@sub.dmn.tld test.server.tld mx.external.dmn SMTP - 1 222807
2008-06-19 08:22:17 me@external.dmn multiple@sub.dmn.tld test.server.tld mx.external.dmn SMTP - 1 222807
2008-06-19 08:22:24 me@external.dmn multiple@als.tld test.server.tld mx.external.dmn SMTP - 1 225409
2008-06-19 08:22:24 me@external.dmn multiple@als.tld test.server.tld mx.external.dmn SMTP - 1 225409
I'm trying to figure out an algorithm that counts the expected total value in all those test cases. Feel free to give me ideas!