This article will speak to how to store more (or less) than the default 60 days of metrics data in the API Portal Legacy (previously known as Classic Portal after 4.0 was released - Classic Portal includes all versions 3.5 and lower).
The API Portal Legacy holds - by default - 60 days of metrics data. This can cause unintended behaviour though when generating API reports for a period of 6 months for example as it would only contain 2 months of data if left at the default value. Additionally if too much data is being consumed due to the metrics data this may need to be lowered from the default value. This article will discuss how to change that value.
API Portal Legacy 3.5 and lower.
The Portal purges metrics 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 the following file: /opt/Deployments/lrs/server/webapps/ROOT/plugins/lrsgateway-conf.xml
If a property named PURGER_NUM_DAYS is not present in the file, the default value of 60 is used which means the Portal will hold 60 days of metrics data.
If the metrics purge functionality is successful, the following log entries should be seen (as an example) at approximately 00:15 of every 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
If the PURGER_NUM_DAYS is missing in the file noted above, it can be added like so:
Other useful information related to this topic: