Matomo friends, Hi I was reading the FAQ ( https://matomo.org/faq/log-analytics-tool/ ) on Log Analytics and need some clarification. If I had a centralized matomo instance on it’s own servers and I have a client website (hosted elsewhere) that is interested in using Log Analytics to track activity (as opposed to the generated JS block). It isn’t clear to me, from the FAQ, what are the requirements for the client system as opposed to the requirements of my central matomo instance. Please confirm I have this right:
I think you understood it correctly.
The server who has Matomo needs nothing apart from the normal Matomo setup (no python).
The server(s) who contain the log files, don’t need any Matomo setup or PHP at all, but just the log analytics python script and python. (you can get the script from https://github.com/matomo-org/matomo-log-analytics/ too)
The only difference is that you need to specify the --token-auth parameter, which when you are running the python script on the Matomo server, it can fetch it automatically.
One day in the future the python script might be replaced with a PHP script so that Matomo doesn’t depend on python at all.
Maybe off topic a bit, but if anyone ends up here looking for a basic example of syntax, I am parking some notes here.
How to import the logs to a test site
I tested these here, just now.
Please check which site ids exist. User your Matomo interface or look in the db*, either is fine.
>> Measurables >> Manage
In Matomo interface click >> >> Measurables >> Manage >> new measurable. Make a new site called “testing site for me” or whatever
Run your python log importer. Use the site ID from Step 2. See that I added an option for which dates to import**.
In your Matomo interface look at the reports data for that test site.
In Visitors >> Overview there should just be all zeros, nothing, because we didn’t run any core:archive to make reports yet
In Visitors >> Visits Log all of the data should show up. If the import worked, data will be here.
Not needed if you succeeded in 4, but if you want to look in the db too, could do this: SELECT COUNT(*) AS hits, idsite, MIN(server_time) as oldest, MAX(server_time) AS newest FROM matomo_log_link_visit_action GROUP BY idsite;
*the query to see IDs SELECT idsite FROM matomo_log_link_visit_action GROUP BY idsite;
**the python options I used to execute the import, in Step 3 sudo python3 /var/www/EXAMPLE.com/matomo/misc/log-analytics/import_logs.py --url=https://EXAMPLE.com/matomo --idsite=14 --recorders=4 --enable-http-errors --enable-http-redirects --debug-tracker --exclude-older-than="2024-10-31 01:01:01 +0500" --token-auth=????????????????93c /var/log/apache2/access.log
Here is that same syntax broken out by line
sudo python3 /var/www/EXAMPLE.com/matomo/misc/log-analytics/import_logs.py
–url=https://EXAMPLE.com/matomo
–idsite=14
–recorders=4
–enable-http-errors
–enable-http-redirects
–debug-tracker
–exclude-older-than=“2024-10-31 00:00:01 +0500” < - - - the 0500 part is hours from UTC to your server time zone
–exclude-newer-than=“2024-11-04 00:00:01 +0500”
–token-auth=???3c
/var/log/apache2/access.log