使用sendmail将邮件保存为Linux上的文件

时间:2014-10-09 15:49:21

标签: linux email logging sendmail

我有一个应用程序在几个RHEL 5.8系统上运行,它监视和警告(通过电子邮件)。我需要在每个节点上本地创建这些警报的持久日志。

我认为最简单的方法是将本地电子邮件用户添加到警报中,然后使用邮箱设置或脚本(如果需要)将每条消息保存在本地文件系统上< / p>

我会解决邮件正文转储到文本文件(每封电子邮件一个文件。)

如果它可以提取时间,主持人,主题和&amp; body作为单独的字段供开源日志阅读器使用。

我的系统正在使用sendmail 8.1,我更愿意坚持使用它,虽然我也有postfix 2.3.3可用。

1 个答案:

答案 0 :(得分:1)

正如您所报道的,您的sendmail使用procmail作为本地邮件程序=&gt;创建特殊的OS用户帐户(例如log_user)并使用~log_user/.procmailrc指示procmail将邮件传递到maildir文件夹。

〜LOG_USER / .procmailrc文件

# deliver ALL messages to ~/maillog/ maildir. 
# see "man procmailex" for email sorting examples 
:0
maillog/