Can someone please suggest a way, how to configure my PI so that it only stores data for last 72 hours only...
Thanks in advance.
My immediate question is, why? This is an odd request as most customers will need to store a large amount of data, not limiting it to 3 days.
There is nothing automatic/out of the box that will help you, but you could probably engineer a solution that is close enough. The only way I can see this working "well enough" is to use a reduced archive set. Create 3 Archives of a big enough size to handle all the events for a day with a little overlap. You will have to disable auto-archive-creation using SMT/tuning parameters. All archives must be marked as shiftable.
You will then have to create a scheduled task to perform an archive shift once a day (say, at midnight?). With Auto Archive Creation disabled and no blank archives, the PI Data Archive will reuse the oldest Archive available. As a result, the data in that existing archive would have been deleted. You won't have exactly 3 days worth of data online at one time; you will have between 2 and 3 depending on how long it has been since the last archive shift. If you want more days, add more archives.
Again, I question why? PI hasn't been designed/optimised for this sort of use case. There is probably a better solution out there.
For example in our cases we have installed a local PI stack to collect and send data via PICC to our global data servers. Some local PI systems are running on a PC that is also handling other important actions on site. I'm aware that this is not the correct way to build the system and we should have a dedicated server for data collection. However these have been cases where we needed to establish the data collection quickly and needed to utilize a server that we already had on site.
To make sure that there are enough resources for other applications to run I would like to limit the local data storage to for example 90 days. As we are storing the data into our global data archive there is no need to store the data locally for longer periods.
I have seen customers use the same approach as Sam mentioned when they want to limit the amount of historical data store in a local PI server. If auto-archive creation is disabled then when the primary archive is full the PI data archive will overwrite the oldest registered archive and start filling current data into that. You shouldn't need to script this archive shift as the system will do it automatically once the primary archive is full. So long as you appropriately size your archives then it will give you a roughly constant window of data online.
I would suggest that you keep a longer period of data online than you think you need though. People may want to access the data from their local system PI system to get better performance, and it may be useful for disaster recovery. Storage is relatively cheap, so even if you don't want to keep the entire history on the local system I would recommend keeping more than you think you would need.
Retrieving data ...