Maillog analysis

accattatevillo ^NOSPAM^ at nowhere.org
Sat May 26 06:07:59 EDT 2001


Im trying to analize a maillog in python:

Mar  2 17:35:15 gw sendmail[27970]: RAA27970: from=<l.pippo at xxx.it>,
size=2271, class=0, pri=32271, nrcpts=1,
msgid=<000b01c0a336$50679120$4000000a at xxx.it>, proto=SMTP, relay=export3
[10.0.0.64]
Mar  2 17:36:39 gw sendmail[27972]: RAA27970:
to=<mc at group.com>,<xx at group.com>, delay=00:01:24, xdelay=00:01:24,
mailer=esmtp, relay=fusilla.abanet.it. [212.28.160.10], stat=Sent
(RAA01419 Message accepted for delivery)

How can i transform the message in a dictionary like:

id:RAA27970
date:Mar  2 17:35:15
from:<l.pippo at xxx.it>
to:<mc at group.com>,<xx at group.com>
size:2271
stat:Sent (RAA01419 Message accepted for delivery)

I tried with re, split etc. but I didn't find an elegant solution.
Any suggestions?

TIA
Steve



More information about the Python-list mailing list