Logs created by the system give us very valuable insights into the application performance and stability. Logs will also help us audit and better recover from failures.

List of logs to enable and backup

How is this log useful? How to enable and where? Log retention period
Web server access logs – Audit of all incoming Matomo requests: tracker, UI, API.
– Tracking requests logged can be replayed into Matomo and backfill data gaps caused by an
outage.
Enabled by default.
eg./var/log/apache2/access*.log
12 months
Web server error logs including PHP error logs Logs warning and error messages for troubleshooting two key components: Web server and PHP. Enabled by default, eg.
/var/log/apache2/error*.
log
12 months
MySQL slow query logs Improve overall performance by detecting root cause of database performance issue. Disabled by default, Enable MySQL slow query logs,
eg./var/log/mysql/mysql-slow.log
6 months
Matomo crontab
tasks logs
– Audit of all Matomo data processing.
– Troubleshoot and improve performance of core:archive processing task.
Set up the crontab entries eg. /path/to/matomo/tmp/logs/matomo.log 6 months
Matomo
application logs
Logs warning and error messages for Matomo troubleshooting. Create a file config/common.config.ini.php eg./path/private-logs/matomo-archive.log 6 months
Matomo Activity
logs
Logs any activity in Matomo UI and API and provides detailed audit log. Enabled by default, available in Matomo > Admin > Activity Log. N/A (forever)
Previous FAQ: How can I find diagnostic information for report archiving?