Make the limit of stored events user configurable

Without this patch the upper limit on the number of stored events
defaults to 100 and cannot be changed by the end user.  This is a
problem because the upper limit may need to change to gather enough
data.  This patch addresses the problem by reading the upper limit from
the STORED_EVENT_LIMIT environment variable.