提供:EELの自由帳
移動先: 案内検索

Mail サーバー : メールログレポート(pflogsumm)(AlmaLinux)

メインページ > Category:自宅サーバー > AlmaLinux 8 で自宅サーバー構築  > Mail サーバー : メールログレポート(pflogsumm)(AlmaLinux)

Postfix ログレポートツール pflogsumm をインストールします。

postfix-perl-scripts パッケージをインストール

[root@host4 ~]# dnf -y install postfix-perl-scripts

昨日分のメールログのサマリーを出力

[root@host4 ~]# perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog
Postfix log summaries for Apr  4

Grand Totals
------------
messages

     66   received
     57   delivered
      4   forwarded
      1   deferred  (1  deferrals)
     42   bounced
      5   rejected (8%)
      0   reject warnings
      0   held
      0   discarded (0%)

  11588k  bytes received
    583k  bytes delivered
     32   senders
     30   sending hosts/domains
      5   recipients
      3   recipient hosts/domains


Per-Hour Traffic Summary
------------------------
    time          received  delivered   deferred    bounced     rejected
    --------------------------------------------------------------------
    0000-0100           3          3          0          0          4 
    0100-0200           5          7          0          2          0 
    0200-0300           1          1          0          0          0 
    0300-0400           2          1          0          2          0 
    0400-0500          15         10          0         14          0 
    0500-0600           1          2          0          0          0 
    0600-0700           3          3          0          0          0 
    0700-0800           2          3          0          0          0 
    0800-0900           2          3          0          0          0 
    0900-1000           2          2          0          0          0 
    1000-1100           0          0          0          0          0 
    1100-1200           0          0          0          0          0 
    1200-1300           0          0          0          0          0 
    1300-1400           2          2          0          0          0 
    1400-1500           1          1          0          0          0 
    1500-1600           1          1          0          0          0 
    1600-1700           0          0          0          0          0 
    1700-1800           1          1          0          0          0 
    1800-1900           1          1          0          0          0 
    1900-2000           2          2          1          0          0 
    2000-2100           3          1          0          4          0 
    2100-2200           1          1          0          0          0 
    2200-2300          18         12          0         20          1 
    2300-2400           0          0          0          0          0 

Host/Domain Summary: Message Delivery 
--------------------------------------
 sent cnt  bytes   defers   avg dly max dly host/domain
 -------- -------  -------  ------- ------- -----------
     33   441584        0     9.0 s    1.6 m  localhost
     16    35030        0     0.6 s    0.8 s  sudachi.jp
      8   120443        1     1.0 m    8.1 m  gmail.com

毎日午前一時に昨日分のメールログのサマリーを root 宛てにメール送信

[root@host4 ~]# crontab -e

# 例として 毎日午前一時に昨日分のメールログのサマリーを root 宛てにメール送信
00 01 * * * perl /usr/sbin/pflogsumm -e -d yesterday /var/log/maillog | mail -s 'Logwatch for Postfix' root