_ = XLATOR.gettext
ngettext = XLATOR.ngettext
-__version__ = '0.3.0'
+__version__ = '0.3.1'
# =============================================================================
if command == 'postfix/smtpd' and pid:
self.eval_smtpd_line(entry)
- return
if postfix_id:
if command == 'postfix/smtpd' and pid:
m = self.re_from_addr.match(message)
if m and postfix_id in self.chain and self.chain[postfix_id]:
- self.logchain[postfix_id].from_address = m[1]
+ self.chain[postfix_id].from_address = m[1]
# -------------------------------------------------------------------------
def eval_smtpd_line(self, entry):
LOG.debug('PostfixLogfileParser %r: {!r}'.format(parser))
- with self.logfile.open('rt') as fh:
+ maillog = self.logfile
+ if 'MAILLOG' in os.environ:
+ env_maillog = Path(os.environ['MAILLOG'])
+ if env_maillog.exists() and env_maillog.is_file() and os.access(env_maillog, os.R_OK):
+ maillog = env_maillog
+
+ LOG.debug('Parsing maillog {!r} ...'.format(str(maillog)))
+ with maillog.open('rt') as fh:
parser.parse(fh)
LOG.debug('PostfixLogfileParser %s:\n{}'.format(parser))