Statistics are similar to Analysis rules in most respects. Statistics have 5 seconds to execute or they will be timed out and set to inactive. They also return a special variable, $retval. The $retval returned by the Statistic will be entered in the database when it is However, the $retval returned by a statistic collector can be any numerical value. Statistics are charted over time for historical and trend analysis.
The lib directory and variable declaration is the same for Statistics as Analysis rules.