limits log size to MAX_EVENTS.