If you are using Matomo On-Premise, then you find the importer script in misc/log-analytics/import_logs.py.

If you are using Matomo Cloud or Matomo for WordPress, you can download the script from GitHub.

$ python /path/to/matomo/misc/log-analytics/import_logs.py

This will display the help information. The only required parameter is

--url=https://analytics.example.com

To specify the Matomo (Piwik) base URL. Then, you can specify one or many log files to import.

If you run the script on a server other than your Matomo server, then you will also need to specify the --token-auth=SECRET_TOKEN_HERE parameter (learn more in our FAQ: where do I find token_auth?).

There are many more options available. See the help output, and the README for more information and explanations about available parameters.

For example, if you wish to track all requests (static files, bot requests, http errors, http redirects) the following command would be used:

python /path/to/matomo/misc/log-analytics/import_logs.py --url=https://analytics.example.com 
--idsite=1234 --recorders=4 --enable-http-errors --enable-http-redirects --enable-static
--enable-bots access.log

Learn more about how to use the script, how to import logs automatically every day, and advanced setups in our Log Analytics Readme.

If you have feature requests for better Server Log processing with Matomo, please let us know using the feedback form below. We look forward to your feedback and hope Matomo will deliver huge value for all server logs.

Previous FAQ: Requirements for Log Analytics