To be recognized, the host must be correctly filled in the Matomo parameters. Path/to/matomo/misc/log-analytics/import_logs.py We can then pass the result to the Python script: /usr/sbin/logtail /var/log/nginx/access.log \ We will use logtail, which allows, at each use, to read only the new lines added to the logs since the last time it has been launched. Matomo comes with a small python script, very efficient, to read the logs and import them: log-analytics/import_logs.py. '"generation_time_milli": $request_time,'įinally, in the server tag which contains the configuration of your site, indicate the location and format where your logs will be stored: access_log /var/log/nginx/access.log matomo įinally, after restarting nginx, the logs should then start in the specified file. In /etc/nf, we declare a new log format named matomo: # /etc/nf Nginx configurationįirst of all, we’re going to use a more readable and parsable json log format in nginx. We will see here how to read Nginx logs in real time under Matomo. Most of the time, these scripts work once a day, but it is possible to implement it almost in real time without the need of a rsyslog or syslog-ng setup. This makes it possible to have statistics without any tracker, impossible to block and therefore reliable, with a very low load for the server. I really appreciate Matomo (formerly Piwik), which is open source, offers a quality interface and plenty options.īy default, Matomo uses a javascript tracker, but it also has a script to import server logs. However, I hate trackers, and I won’t consider using Google Analytics which would retrieve much more private information about my users for its own account. I must admit, I like to know how many people visit my site. Real-time log analytics with Matomo – Sylvain Durand sylvain durand Real-time log analytics with Matomo
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |