How do I migrate from AWStats to Matomo?
Migrating from AWStats to Matomo involves a few steps, but the Matomo team has worked to make it as easy as possible: especially since Matomo can directly import web server logs. Here’s a high-level process:
-
Install Matomo: Download Matomo from the official website and install it on your server (or set up a Matomo Cloud account if you chose the hosted option). The installation is web-based and similar to installing a content management system or forum software. You’ll create an admin account and configure the database during this step.
-
Create your site in Matomo: Once Matomo is running, log in and create a new website (or “property”) in Matomo for the site you want to track. This will give you a Site ID and an auth token etc., which are used for tracking. If you have multiple sites that you monitored with AWStats, create each of them in Matomo.
-
Prepare your log files: Gather the web server access log files that AWStats has been analysing. Typically, AWStats processed logs like
access.log
(Apache) or similar. If you have historical logs (for example, archived by month), decide how far back you want to import. Matomo’s importer can handle large log files and even compressed files. -
Run Matomo’s log import tool: Matomo includes a command-line script called
import_logs.py
(found in the /misc/log-analytics/ folder of Matomo). You’ll use this script to read your log files and send the hits to Matomo for processing. The basic usage looks like:
python3 /path/to/matomo/misc/log-analytics/import_logs.py --url=http://YOUR_MATOMO_URL --idsite=X /path/to/your/access.log
-
Import files: You can import one log file at a time or multiple, and there are options to specify log format if needed (though it auto-detects common formats). Important: Make sure to use the correct
--idsite
corresponding to the site you created in Matomo. Run this script for each log file (or configure it to run through all your logs). Matomo will then create analytics reports from those logs. This effectively migrates your historical data into Matomo. -
Schedule regular imports (if continuing with log analytics): If you want Matomo to continue using logs (and not a JS tracker), set up a cron job to regularly import new log entries. For example, you might run the import script every night for the previous day’s log, or every hour for the recent hour’s data. This way, Matomo will stay up-to-date with minimal delay. Matomo can even be configured to auto-import in near real-time by tailing the log file (there’s a mode for that), similar to how AWStats could be run periodically via cron.
-
Alternative: switch to JS tracking (optional): If you prefer, you can place Matomo’s JavaScript tracking code on your site footer instead of (or in addition to) using log import. AWStats didn’t have this capability, but Matomo gives you the choice. The JS tracker will collect data directly in real-time. You might choose this if you want more detailed data or if it’s easier for you. It’s not required, though: it’s just an option.
-
Validate the data: After importing logs, compare some key metrics with your last AWStats reports to ensure the tracking is consistent. You might notice small differences in how visits or uniques are counted due to different algorithms, but generally it should be in the same ballpark. Matomo filters bots by default (AWStats counted them separately), so your Matomo “visit” counts might only count humans, which in many cases is what you want. You can configure Matomo to include bots if needed.
-
Learn Matomo’s interface: Spend some time exploring Matomo’s reporting interface. It’s quite intuitive: you can view various reports (visitors, behavior, acquisitions, etc.). Many former AWStats users find it refreshing to have an interactive UI after years of static HTML pages: for example, you can click on a specific day to zoom in, or sort referrers by different metrics, etc. Matomo also offers features like scheduling email reports (similar to how you might have emailed AWStats reports) and setting up alerts for certain conditions.
In summary, the migration involves installing Matomo, importing your historical logs, and then choosing a method for ongoing data collection. The Matomo documentation provides a detailed walkthrough for the log import process and there’s a helpful community if you run into any issues. Once set up, you’ll have all your old data in Matomo and can decommission AWStats.