Recommended Free Tools
Matomo Log Analytics is a Python command-line importer. It reads your web server’s access logs and sends each line to Matomo as a tracked request. You run it with import_logs.py --url=your Matomo URL --idsite=ID logfile. The one thing to get right first is duplication: Matomo does not detect repeat imports, so a log file imported twice is counted twice.
What you need before importing
According to Matomo’s requirements page, Log Analytics works with Matomo Cloud, Matomo On-Premise and Matomo for WordPress. Matomo lists these requirements:
As an Amazon Associate I earn from qualifying purchases.
- SSH, or another way to run scripts on a server.
- Python 3.5 or newer. Matomo’s page states “Python 3.5 or newer required.” Check the README that ships with your copy of the script, because requirements can change.
- One or more log files whose lines are in date order.
Log fields that improve reports
Matomo recommends logs that contain the User-Agent, the referrer URL and the full request URL including the hostname. Logs without these fields can still be imported. Some reports may then be missing or less accurate.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Geolocation
Access logs have no browser-language field to fall back on, so country and city reports depend on IP geolocation. On-Premise installations need geolocation set up for accurate results. Matomo says it handles this automatically for Cloud and Matomo for WordPress.
#1 Best Overall
- Used Book in Good Condition
Create a dedicated website in Matomo first
Create a separate Matomo website for imported logs and note its site ID. This matters most if you also use the JavaScript tracker or the Tracking API. Matomo’s FAQ says the methods can coexist if each records to its own website. If you import logs into the same website the JavaScript tracker feeds, the counts can be doubled.
How do I import server logs into Matomo?
1. Locate the script
On-Premise installations include it at misc/log-analytics/import_logs.py. Matomo Cloud and Matomo for WordPress users download it from the GitHub repository that Matomo links in its documentation. See Matomo’s guide to running the importer with default options.
Rank #2
2. Run it against a test site
The documented required parameter is --url, the base URL of your Matomo. After that, list one or more log files. A minimal command looks like this:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemspython3 /path/to/matomo/misc/log-analytics/import_logs.py
--url=https://analytics.example.com
--idsite=1234
/path/to/access.log
--idsite picks the destination Matomo website. It is not strictly required for every setup, but you should set it so data lands where you expect. Not every flag is needed.
Rank #3
3. Add authentication if the script runs elsewhere
If the importer runs on a different server from Matomo, add --token-auth with an API authentication token. For Matomo Cloud, the Cloud FAQ says Log Analytics can be used and tells you to untick “Only allow secure requests” when you create the token for this purpose.
4. Choose the log format and options
The importer usually detects the format on its own. To force one, use --log-format-name. The FAQ lists these names: common, common_vhost, ncsa_extended, common_complete, w3c_extended, amazon_cloudfront, iis, shoutcast, s3, icecast2, elb, nginx_json and ovh. Optional flags exist for recording HTTP errors, redirects, static files and bots. Use --debug when troubleshooting.
Rank #4
The format list and the options depend on the importer version. Run the script with --help and read the README that came with your copy for the current set.
5. Check the results
Open the test website’s reports in Matomo and confirm that visits, pages and dates look right. Only then import into the real destination.
Best Value
Avoiding duplicate data
Matomo states that the importer has no check for redundant data. Importing the same material again can double or triple the numbers without any warning. Keep a record of which files you have imported. Test on a test site first. If a rotated log overlaps one you already loaded, do not import the overlap again.
Troubleshooting
- Zero requests imported with no error: check file permissions. Matomo suggests checking which user runs the script. For routine imports, use a specific user rather than running as superuser.
- Missing or odd reports: check whether your log format includes User-Agent, referrer and full URL with hostname.
- Wrong format detected: set
--log-format-nameexplicitly and add--debug. - Out-of-order dates: sort or combine logs chronologically before importing, since the importer expects date-ordered lines.
Choosing between log import, JavaScript and the Tracking API
All three methods can feed Matomo. Think about these questions when picking one:
- Can you change the site’s code to add a tracker?
- Do your logs contain the fields behind the reports you want?
- Will you run more than one method? If so, each needs its own Matomo website to avoid duplicate counts.
- Which deployment do you use? Cloud and WordPress handle geolocation for you. On-Premise needs it configured.
Matomo’s documentation does not give a feature-by-feature comparison of what each method can report, so this article does not make one.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Frequently Asked Questions
Can I use Matomo Log Analytics with Matomo Cloud?
Yes. Matomo’s Cloud FAQ says Log Analytics can be used with Matomo Cloud. Download the script from GitHub and run it with a token.
Can I use server log analytics and the Matomo JavaScript tracker together?
Yes, but only if each method records to a separate Matomo website. The same website would produce double counts.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




