Created
June 5, 2018 12:39
-
-
Save fedek6/60b88d24958bd249e78d59b9b24d6e07 to your computer and use it in GitHub Desktop.
Bat for importing Matomo logs on Windows enviroment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Based on https://matomo.org/docs/log-analytics-tool-how-to/ | |
:: Global config | |
:: Python URL (must be 2.x) | |
SET PY_BIN=C:\Program Files\Python\Python27\python.exe | |
:: Matomo import_logs executable | |
SET IMPORT_LOGS=C:\inetpub\htdocs\piwik\misc\log-analytics\import_logs.py | |
:: IIS log dir | |
SET LOGS_DIR=C:\inetpub\logs\LogFiles | |
:: Access token from Piwik config | |
SET TOKEN=********************************* | |
:: URL to your Piwik installation | |
SET URL=http://yourstats.org | |
:: CPU threads | |
SET THREADS=2 | |
:: Change this according to your system locale. | |
:: Current setting is based on dd.mm.yyyy format (Poland) | |
SET DAY=%date:~0,2% | |
SET MONTH=%date:~3,2% | |
SET YEAR=%date:~8,2% | |
:: First website | |
:: @Adrianu: This part should be imported from matomo.json file | |
SET DIR=W3SVC3 | |
SET ID=1 | |
:: Automatically generated vars | |
SET LOG_FILE=u_ex%YEAR%%MONTH%%DAY%.log | |
SET LOG_PATH=%LOGS_DIR%\%DIR%\%LOG_FILE% | |
:: Run command | |
"%PY_BIN%" "%IMPORT_LOGS%" --url=%URL% --idsite=%ID% --token-auth=%TOKEN% --recorders=%THREADS% --enable-http-errors --enable-http-redirects --enable-static --enable-bots "%LOG_PATH%" | |
@echo Parsed log file: %LOG_PATH% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"id":1, "dir":"W3SVC3", "name":"www.mnw.art.pl"} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment