[[chapter_stats]]
Statistics
==========

{pmg} provides a useful and feature-rich statistics interface that allows
administrators to quickly get an overview of the overall workload and easily
identify problems.

The statistics are displayed for a selected period, which by default is the
current day. This period can be changed to any other day, a whole month or even
a whole year.

[thumbnail="pmg-gui-statistics-general.png", big=1]

On the main statistics page there are three graphs with additional data:

'Total Mail Count'::

Shows the total mail flow as a graph and the following details:

* Total Mails
* Incoming/Outgoing Mails (as count and percentage)
* Virus Outbreaks (the amount of outgoing virus mails)
* Avg. Mail Processing Time
* Incoming/Outgoing Mail Traffic

'Incoming Mails'::

Displays the count of incoming mails from each of the following categories,
including their percentage of the total incoming mail volume:

* Incoming Mails
* Junk Mails (Virus + Spam + Greylisted + SPF rejects + RBL rejects)
* Greylisted Mails
* Spam Mails (Mails with Spamscore >= 3 and not containing a virus)
* SPF rejects
* Bounces (mails with an empty envelope-sender address)
* Virus Mails

'Outgoing Mails'::

Displays the count of outgoing mails from each of the following categories,
including their percentage of the total outgoing mail volume:

* Outgoing Mails
* Bounces (mails with an empty envelope-sender address)
* Virus Mails

[[pmgstats_spam_scores]]
Spam Scores
-----------

[thumbnail="pmg-gui-statistics-spam-scores.png", big=1]

The `Spam Scores` panel shows the distribution of the different spam scores for
the selected time period. Note that you can also select a whole month or even a
whole year as period to display.

[[pmgstats_viruses]]
Virus Charts
------------

[thumbnail="pmg-gui-statistics-virus-charts.png"]

The `Virus Charts` panel gives you an overview of how many virus files were
tried to be transmitted through your mail infrastructure, but got caught early
by the {pmg}.

The list shows which and how often a certain viruses were detected in the
selected time period.

See xref:pmgconfig_clamav[Virus Detector Configuration] for details about how
{pmg} scans for virus files.

[[pmgstats_hourly_distribution]]
Hourly Distribution
-------------------

[thumbnail="pmg-gui-statistics-hourly-distribution.png", big=1]

The `Hourly Distribution` shows the amount of incoming and outgoing mail per
hour for the selected time period. For periods spanning a whole month or a
whole year the arithmetic average of mail volume in an hour will be shown.

[[pmgstats_postscreen]]
Postscreen
----------

[thumbnail="pmg-gui-statistics-postscreen.png"]

Contains a chart with the RBL (Real-time Blackhole Lists) and `pregreet`
rejects for the selected time frame.

[quote, Postfix Postscreen Howto]
____
For each connection from an SMTP client, postscreen(8) performs a number of
tests in the order as described below. Some tests introduce a delay of a few
seconds. postscreen(8) maintains a temporary allowlist for clients that pass
its tests; by allowing allowlisted clients to skip tests, postscreen(8)
minimizes its impact on legitimate email traffic.
____

For more info about postscreen and pregreet tests, see the
https://www.postfix.org/POSTSCREEN_README.html[postscreen readme].

[[pmgstats_domain]]
Domain
------

[thumbnail="pmg-gui-statistics-domain.png"]

The `Domain` view is split into two tabs, one for incoming and one for outgoing
mails.

Each tab shows a list of domains that received mails in a selected time frame,
with stats for:

* traffic amount
* counts for:
** mail flow to a domain
** how many viruses were detected,
** and how many mails were classified as spam

[[pmgstats_sender]]
Sender
------

[thumbnail="pmg-gui-statistics-sender.png", big=1]

The `Sender` panel contains a list of e-mail addresses that sent mail out in
the selected time frame, with a total count, how many viruses were detected and
how big these mails were.

If you click on one of these e-mail addresses, you see a detailed list of
recipients, complete with size, date and time.

[[pmgstats_receiver]]
Receiver
--------

[thumbnail="pmg-gui-statistics-receiver.png"]

Similar to the `Sender` panel, this contains a list of e-mail addresses that
received e-mails from outside, with a total, spam and virus count, as well
as the total mail size.

If you click an entry, it shows a detailed list of mails with size, date,
time, virus and spam score info.

If the `Use advanced statistics filters` option (`Configurations -> Options`)
is enabled, only active accounts will be listed. Active accounts are those that
sent mail during the selected time period or up to 90 days before.

[[pmgstats_contact]]
Contact
-------

[thumbnail="pmg-gui-statistics-contact.png"]

This contains the list of external recipients that received mail from this
{pmg}, coming in on the internal port, with total count, virus count and size.

If you click an entry, it shows a list of mails with size, date and time.

If the `Use advanced statistics filters` option (`Configurations -> Options`)
is enabled, active accounts will be filtered out, since they can already be
seen in the `Receiver` panel.  Active accounts are those which sent mail in the
selected time frame or up to 90 days before.
