| Description Given a postfix logfile, each line contains several fields where
Jan 22 18:10:00 mx postfix/smtpd[16290]: 4D6FB267DA: client=wsgw01.wasabi.net
Jan 22 18:10:02 mx postfix/cleanup[15567]: 4D6FB267DA: message-id=<C387C1298A4AB44F8486C0C239F6EF723B3DDA@HKEXCHVS1.res.ghi.net>
Jan 22 18:10:03 mx postfix/qmgr[4135]: 4D6FB267DA: from=<bong@brand.com>, size=28277, nrcpt=3 (queue active)
Jan 22 18:10:05 mx postfix/smtp[16111]: 4D6FB267DA: to=<amber@regex.biz>, relay=127.0.0.1[127.0.0.1]:10024, delay=5.8, delays=4.1/0/0/1.7, dsn=2.6.0, status=sent (250 2.6.0 Ok, id=15634-14, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 4F58927F92)
Jan 22 18:10:05 mx postfix/smtp[16111]: 4D6FB267DA: to=<eric@regex.biz>, relay=127.0.0.1[127.0.0.1]:10024, delay=5.8, delays=4.1/0/0/1.7, dsn=2.6.0, status=sent (250 2.6.0 Ok, id=15634-14, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 4F58927F92)
Jan 22 18:10:05 mx postfix/smtp[16111]: 4D6FB267DA: to=<rosa@regex.biz>, relay=127.0.0.1[127.0.0.1]:10024, delay=5.8, delays=4.1/0/0/1.7, dsn=2.6.0, status=sent (250 2.6.0 Ok, id=15634-14, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 4F58927F92)
Jan 22 18:10:05 mx postfix/qmgr[4135]: 4D6FB267DA: removed
describes a mail transaction from <bong@brand.com> to three recipients. From above log messages, We want to get a summary consisting of the SMTP id, followed by the email addresses of the mail sender and all the recipients: 4D6FB267DA: from=<bong@brand.com> to=<amber@regex.biz> to=<eric@regex.biz> to=<rosa@regex.biz>
But the real log file is not so simple since log messages of several transactions may interleave, like INPUT, and the desired output is OUTPUT. | ||||
Script and Comments
| ||||