Statistics are collected as counters (legends) and also automatically made into historical line graphs (round-robin databases).
Some counters are created automatically, such as configured domains. If you only have an any (catch all) domain, you will not get domain statistics. If you need statistics for a particular domain, add each domain as domain aliases to your any domain.
To create your own counters or line graphs, use the stat() core function. Pie charts can also display entries from the rate() function.
On the non-clustered activity page, you can view the available legends by pressing the "Legends" button. Legends can also be extracted using the statList SOAP call.
Line charts (graphs)
Line graphs are automatically created from the legends (counters). The raw round-robin database data can be fetched using the graphFile call.
When pressing "Edit" on a pie chart, you can enter expressions line-by-line. Each line is interpreted standalone, but added together in the resulting pie. There are two syntaxes; one based on keys, and another on math.
Key-based expressions maps directly to values the legends database. They contain a key name, and a legend filter, separated by ":". Each legend has three "parts" (keys), and the filter specifies those parts separated by "," (comma). You can use "%" as a wild-card, in order to do partial matching. If multiple legends are matched by your legend filter, they are grouped and summarized. You can make up your own keys, which will be used as labels, such as
or use any of the special (reserved) key names, which expands to multiple entires
The first example, key1, would probably match two legends (ippolicy:allow,mailserver:1 and ippolicy:block,mailserver:1) because if the "%" (wild-card). Since the key name is key1, it will use the first part (key) as label (allow and block). Because no third legend key was given, the last one (key3) automatically becomes a wild-card match, and would have been summarized if multiple legends were matched.
The math based syntax is name=expression. They are identified by their "=" separator.
foo=rand(1,10) bar=(5+10)/3 pass=v("hsl:stat,dkim,pass") total=r("perday,total")
Please note that the v() function may match one legend. The q() function returns number of hits based on a queue search.
To view a certain metric for an arbitrary period of time, rate controls can be used (because counts expire). This method only works up to a certain amount of traffic; otherwise it will consume too much CPU (keep in mind that each "count" in an actual item in memory). For example, to view the amount of messages per week (works up to 100000 messages), you could use a script such as
rate("week-stat", "total", 100000, 3600*24*7);
in the very beginning of the content flow, and
rate("week-stat", "delivered", 100000, 3600*24*7);
at the very end, just before the message is delivered. To visualise it, you could create a pie chart like