embedded mysql database only keep 2 months data

Document ID : KB000104914
Last Modified Date : 05/07/2018
Show Technical Document Details
Question:

May i know how to check this setting where embedded mysql database only keep 2 months data ?

I would like to fine tune this setting as end user requested to have 1 year data . 
Environment:
API Developer Portal 3.5
API Gateway 9.3 
Answer:

The Portal purges metric data on a daily basis. The schedule is controlled by the Portal's Scheduler plugin. Hourly metric data older than x days is removed and quarter hourly metric data older than 1 day is removed each time that the purger task is run. x is configurable using the PURGER_NUM_DAYS configuration property in :
     /opt/Deployments/lrs/server/webapps/ROOT/plugins/lrsgateway-conf.xml.

PURGER_NUM_DAYS defaults to 60 if not present. 
---- 

If the metrics purge is functioning properly you should see the following log entries at 00:15 each day. 

05/15 00:15:00.007 INFO (SimpleThreadPoolWorker-8:) - Purging data with resolution=1 that is 60 day(s) older than Tue May 15 00:15:00 JST 2018 (period start less than or equal to 1521126900001) in batches of 100. 
05/15 00:15:00.008 INFO (SimpleThreadPoolWorker-8:) - Finished purging data 

---- 

Actually, the "PURGER_NUM_DAYS" is missing in our configuration file lrsgateway-conf.xml 

To add it : 

1. <Property name="PURGER_NUM_DAYS">60</Property>
    should go in the <Properties> node. 

2. A restart of the Portal is required after editing lrsgateway-conf.xml 
 
Additional Information:
Other background information: 

A 15 minute metric is the hits for a 15 minute period (ex: 00:15 to 00:30). There are 96 of them in a day. 

A 1 hour metric is the hits for a 60 period (ex: 00:00 to 01:00). There are 24 of them in a day. 

These metrics are created by a cron job on the gateway. 

Since, the 15 minute metrics are only used for the "Last 24 hours" report criteria any 15 minute metrics records older than yesterday are not necessary and are purged. For example: the purge than runs at 00:00 on the 30th will purge records for 28th and keep the records for the 29th. Running a "Last 24 hours" report on the 30h when you select the from date as the 29th and the to date as the 30th will use the 15 minute metrics for the 29th and 30th. 

I don't recommend changing the schedule of the 15 minute metrics purge since the purge removes records older than 24 hours. It needs to run at midnight so that it purges the correct data. 

----- 

So the data is held in different levels for different metric choice for the report, and also it is deleted /retained depending on which level it is. That should explain what you are seeing 


---