postfix的电子邮件日志脚本提示

时间:2018-04-24 14:26:55

标签: shell grep

我写了一个简单的脚本,显示来自mail.log的已发送邮件。它使用grc为结果着色。

log='/var/log/mail.log'
grc grep "status=sent" $log | \
egrep -ve 'postfix/(cleanup|pickup|master|qmgr|smtpd|local|pipe)'

它运作得很好,但我想过滤掉一些噪音。 我怎样才能过滤掉这样的东西...

delay=0.34, delays=0.01/0.02/0.14/0.16, dsn=2.0.0,

2 个答案:

答案 0 :(得分:0)

这对于在Postfix / Debian上发送电子邮件非常有效:

# Script to list sent emails on Postfix/Debian
log='/var/log/mail.log'
grep "status=sent" $log | \
egrep -ve 'postfix/(cleanup|pickup|master|qmgr|smtpd|local|pipe)' | cut -f2 -d"="  | cut -f1 -d">" | cut -c2-

答案 1 :(得分:0)

这非常适合Postfix / Debian上的传入电子邮件:

# Script to list recived emails
log='/var/log/mail.log'
grep "from=" $log | \
egrep -ve 'postfix/(submission|cleanup|pickup|master|smtps|smtpd|local|pipe)' | cut -f2 -d"="  | cut -f1 -d">" | cut -c2-