A generic usage activity tracker for Matomo platform. The script is based on the Matomo log analytics tool [1]. The script:
- Parses the Web server log files
- Cleans non-legitimate traffic, eg. bots, search engines using the COUNTER Robot list
- Imports usage activity for metadata and downloaded items from repositories to OpenAIRE's Matomo platform.
Requires python 3.
- Install virtualenv
$ pip install virtualenv - Create a virtual environment for the project
$ virtualenv -p /usr/bin/python3 matomo_tracker - Activate the virtual environment:
$ source matomo_tracker/bin/activate - Download matomo_import_logs.py and matomo.yaml to activated project folder
- Configure matomo parameters in matomo.yaml
- Install the following packages:
pip install pyyaml
- Run the importer
$python3 matomo_import_logs.py {logs_folder}or$python3 matomo_import_logs.py {log_file}
- The imported logs should be removed from the {logs_folder} to avoid duplication of events.
- Skip the
nfirst lines to start parsing/importing data at a given line for the specified log file using -snor --skip=n(eg. -s 1000 or --skip=1000 ) - Configure the
LogFileFormatparameter in yaml for a customized log file format