使用 logwatch 监控系统日志

使用 logwatch 监控系统日志
  1. 配置好 postfix

  2. 安装 logwatch

    sudo apt install logwatch
    
  3. 配置 Logwatch:

    sudoedit /usr/share/logwatch/default.conf/logwatch.conf
    
    MailTo = example@gmail.com    # 改为你 postfix 配置的发件人
    MailFrom = example@gmail.com  # 改为实际收件人
    Range = yesterday
    Detail = Low
    Service = All
    DailyReport = Yes
    Output = mail
    Format = html
    
  4. 发送测试日志:

    sudo logwatch --detail Low --mailto example@gmail.com --service All --range All
    

参考:How To Install and Use Logwatch Log Analyzer and Reporter on a VPS | DigitalOcean

参见:Linux 使用 SMTP 发送邮件 | 博客园