Skip to content

Instantly share code, notes, and snippets.

@fedek6
Created June 6, 2018 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedek6/2b859c8b3d17247fc7534f3c2c12dc96 to your computer and use it in GitHub Desktop.
Save fedek6/2b859c8b3d17247fc7534f3c2c12dc96 to your computer and use it in GitHub Desktop.
Automatic log parsing for matomo using Bat
@echo off
:: Based on https://matomo.org/docs/log-analytics-tool-how-to/
:: Global config
SET PY_BIN=C:\Program Files\Python\Python27\python.exe
SET IMPORT_LOGS=[path to matomo]\piwik\misc\log-analytics\import_logs.py
SET LOGS_DIR=C:\inetpub\logs\LogFiles
SET TOKEN=****************************
SET URL=http://website.com/piwik/
SET THREADS=2
:: Change this according to your system locale.
:: Current setting is based on dd.mm.yyyy format.
SET DAY=%date:~0,2%
SET MONTH=%date:~3,2%
SET YEAR=%date:~8,2%
:: Site 1
SET DIR=W3SVC3
SET ID=3
:: Zmienne generowane po dacie i ścieżkach
SET LOG_FILE=u_ex%YEAR%%MONTH%%DAY%.log
SET LOG_PATH=%LOGS_DIR%\%DIR%\%LOG_FILE%
"%PY_BIN%" "%IMPORT_LOGS%" --url=%URL% --idsite=%ID% --recorder-max-payload-size=200 --token-auth=%TOKEN% --recorders=%THREADS% --enable-http-errors --enable-http-redirects --enable-static --enable-bots "%LOG_PATH%"
@echo Parsed log file: %LOG_PATH%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment