When I enable “Purge old logs” in the Privacy settings, how do I make sure that no historical data is lost?
If you enable ‘Purge old visitors logs‘ in the Administration > Privacy menu, Matomo (Piwik) will regularly delete your Visitor Logs from the Database. The Logs are used by Matomo to process Reports such as “Top Keywords”, “Top pages”, etc. If some old logs are deleted from your database, but reports have not been yet processed, the data will be lost forever.
We highly recommend that before deleting old visitor logs from your database,
1) you setup the automatic archive processing,
2) and run the
console core:archive console command until completion at least one time, making sure there are no errors during the execution.
This will ensure that all daily reports for each website have been pre-processed and the logs are no longer needed for these days.