Setting a maximum time horizon for events

You can control how long events remain visible to the solution by configuring the time horizon in the agent descriptor when you create an agent. You set the maxHorizon and clearDBCount properties in the solution_properties.xml file.

About this task

The time horizon specifies how long events remain visible to the solution. The maxHorizon property allows you to limit the horizons that are used by the solution to control the database and memory requirements for storing events. To learn more about setting the time horizon at the agent level, see Completing the agent descriptor.

A horizon is always used. When a time horizon is not defined for an event in the agent descriptor, the maxHorizon solution property is used. If there is no time horizon in the agent descriptor and no maxHorizon solution property defined, then the system uses the default of 1 year. The longest time that you can set for maxHorizon is 68 years. For more information, see System properties.

Events that are older than the time horizon are no longer visible to the solution. Events past the horizon are not considered in the calculation of aggregates or event correlation. The maxHorizon property defines a maximum time horizon that determines how long events are retained.

The maxHorizon property overrides the time frame that is defined in a rule. For example, if a rule includes the following statement:
the number of purchase events in the last period of 1 year
And the maxHorizon is set to P6M (six months), then the rule operates on events created in the past six months instead of one year.

In a production server with data persistence enabled, events that exceed the specified time horizon remain in the backup database even when they are removed from the grid. Events are removed from the grid before the specified time horizon only when the eventCacheDuration property value is smaller than the maxHorizon. Each server monitors the number of events per event type per server that have been removed from the grid. When the count reaches the value of the clearDBCount property, the server issues a call to the database to delete all events of this type that exceed the maxHorizon from the backup database.

Procedure

  1. Open the solution_properties.xml file that is in the root folder of the solution project.
  2. Add the maxHorizon property for the solution or agent to the file.
  3. Add the clearDBCount property when you deploy the solution to production, and specify an event count. The default minimum event count is 10000. When the event count of any event type on any server is reached, the events that are older than the maxHorizon are removed from the database.

Example

The following maxHorizon property applies to the entire solution and is set to 6 months.
<property name="maxHorizon">P6M</property>
The following example shows the clearDBCount property with an event count set to 5000:
<property name="clearDBCount">5000</property>