[8] Poczta – Raporty (pflogsumm)

5 lutego 2022 Wyłączono przez Adam [zicherka] Nogły

Zainstaluj pflogsumm, które jest narzędziem raportowania logów Postfix.

[1] Zainstaluj pakiet postfix-perl-scripts.

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

#wygeneruj raport z logów za wczoraj
[root@vlsr01 ~]# perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog
Postfix log summaries for Feb  3
Grand Totals
------------
messages
      8   received
      8   delivered
      0   forwarded
      0   deferred
      1   bounced
      0   rejected (0%)
      0   reject warnings
      0   held
      0   discarded (0%)
   4484   bytes received
   6535   bytes delivered
      3   senders
      1   sending hosts/domains
      4   recipients
      2   recipient hosts/domains
Per-Hour Traffic Summary
------------------------
    time          received  delivered   deferred    bounced     rejected
    --------------------------------------------------------------------
    0000-0100           0          0          0          0          0
    0100-0200           0          0          0          0          0
    0200-0300           0          0          0          0          0
    0300-0400           0          0          0          0          0
    0400-0500           0          0          0          0          0
    0500-0600           0          0          0          0          0
    0600-0700           0          0          0          0          0
    0700-0800           0          0          0          0          0
    0800-0900           0          0          0          0          0
    0900-1000           0          0          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           0          0          0          0          0
    1400-1500           0          0          0          0          0
    1500-1600           0          0          0          0          0
    1600-1700           2          2          0          0          0
    1700-1800           1          1          0          0          0
    1800-1900           2          2          0          1          0
    1900-2000           0          0          0          0          0
    2000-2100           0          0          0          0          0
    2100-2200           3          3          0          0          0
    2200-2300           0          0          0          0          0
    2300-2400           0          0          0          0          0
Host/Domain Summary: Message Delivery
--------------------------------------
 sent cnt  bytes   defers   avg dly max dly host/domain
 -------- -------  -------  ------- ------- -----------
      7     6012        0     0,0 s    0,0 s  zicher.lab
      1      523        0     0,0 s    0,0 s  localhost
Host/Domain Summary: Messages Received
---------------------------------------
 msg cnt   bytes   host/domain
 -------- -------  -----------
      8     4484   zicher.lab
Senders by message count
------------------------
      4   user01@zicher.lab
      3   mailuser@zicher.lab
      1   cent@zicher.lab
Recipients by message count
---------------------------
      4   user01@zicher.lab
      2   cent@zicher.lab
      1   mailuser@zicher.lab
      1   mailuser@localhost
Senders by message size
-----------------------
   2552   user01@zicher.lab
   1419   mailuser@zicher.lab
    513   cent@zicher.lab
Recipients by message size
--------------------------
   4296   user01@zicher.lab
   1275   cent@zicher.lab
    523   mailuser@localhost
    441   mailuser@zicher.lab
message deferral detail: none
message bounce detail (by relay)
--------------------------------
  local (total: 1)
         1   Permission denied
message reject detail: none
message reject warning detail: none
message hold detail: none
message discard detail: none
smtp delivery failures: none
Warnings
--------
  local (total: 2)
         1   maildir access problem for UID/GID=0/0: create maildir file /ro...
         1   perhaps you need to create the maildirs in advance
  smtpd (total: 1)
         1   TLS library problem: error:14094412:SSL routines:ssl3_read_byte...
Fatal Errors: none
Panics: none
Master daemon messages
----------------------
      2   daemon started -- version 3.5.8, configuration /etc/postfix
      1   terminating on signal 15

[root@vlsr01 ~]# crontab -e
# na przykład wyślij podsumowanie dziennika poczty codziennie o 1:00 do user01
00 01 * * * perl /usr/sbin/pflogsumm -e -d yesterday /var/log/maillog | mail -s 'Logi dla programu pocztowego POSTFIX' user01