How to send Apache logs to Matomo?


What I need to do is send some apache logs to my Matomo page. However, I do not have Matomo installed in that particular container, I just have the logs (using sidecar container for the logging system).

The way I try to achieve this is by installing matomo analytics tool and then running the script, however I get several errors. The first one is that it can not find the config.ini.php file. Why would I need the matomo configuration file since I do not even have matomo installed there?

Is there another way to send apache logs to Matomo from a machine that just has the logs and nothing else installed?

(Fabian Dellwing) #2

We rsync them to the stats server and import them there.

(Lukas Winkler) #3


(Disclaimer: This is a very simple explaination of someone who has never used logimport before)

Matomo requires admin rights to mass import tracking requests (otherwise everyone could import tracking data to your instance).
Therefore it automatically uses the config.ini.php to get them

If you are on another server you can add the --token-auth=THETOKEN parameter to manually specify the token-auth of an admin(?) user on the Matomo instance.

Update: From the help command:

You must use a token_auth that has at least ‘admin’ or ‘super user’ permission.
If you use a token_auth for a non admin user, your users’ IP addresses will not be tracked properly.


Okay I understand the logic behind this. We need to know who wants to import logs into Matomo, this makes sense. I am new to this technologies that’s my question might sound basic.

However, when I run script with the --token-auth, I get a huge chunk of what seems as an HTML code. Probably the server is unreachable, but I can not really understand where the error lies. The terminal fills up completely with unreadable HTML code.

(Lukas Winkler) #5

Hm, it’s hard to know where the error lies, but for testing you could try using --user and --password instead. Maybe that changes something.


I still get exactly the same error, terminal just fills with HTML code. What might the cause be? I believe I shouldn’t see any HTML code in the terminal even in case of an error.

In the logs container all I have is log-analytics installed plus a folder that contains the logs. I run the script with the URL pointing to my matomo site and with an admin user token.

Is this how it is supposed to be done?

The container should be able to communicate with the Matomo server without any issues, but I am not really sure how I can confirm that the communication exists.