Slightly modified version of piwik's misc/log-analytics/import_logs.py