====== Piwik ====== [[http://piwik.org/|Piwik]] ist eine Analysesoftware für Webseiten/Webserver. ===== Installation ===== Zunächst müssen folgende Softwarepakete installiert werden (Anforderungen): * Webserver (Apache, Nginx, IIS, etc.) * PHP version 5.3.2 oder höher * MySQL Version 4.1 oder höher * PHP erweiterungen "pdo" und "pdo_mysql", oder "mysqli" Eine Anleitung zur Installation in Englisch findet man unter [[http://piwik.org/docs/installation-optimization/]]. Hier meine Anleitung. Als erstes muss man das Softwarepaket herunterladen und im Webserververzeichnis entpacken, danach noch die Dateirechte anpassen. cd /var/www wget http://builds.piwik.org/piwik.zip unzip piwik.zip chown -R www-data.www-data piwik In MySQL legt man nun noch einen Benutzer und eine Datenbank für Piwik an. mysql -u root -p CREATE DATABASE ; CREATE USER ''@'localhost' IDENTIFIED BY ''; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON .* TO ''@'localhost' WITH GRANT OPTION; exit Nun noch die Piwik Webseite öffnen und die Grundinstallation durchführen ([[http://SERVERNAME/piwik]]). ===== Konfiguration ===== Piwik lässt sich auf verschiedene Weise mit Daten füttern. Hier einige Konfigurationen ==== nginx access.log mit cron ==== Nginx Logformat definierten und die jew. Webseitenkonfigurationen mit diesem Format anpassen. Logformat z.B. in ''/etc/nginx/nginx.conf'' log_format piwik '$host $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $http_referer" "$http_user_agent"'; Webseitenkonfiguration access_log / piwik; Nun eine ausführbare Datei erstellen, welche vom Cron-Job ausgeführt wird. vi /usr/local/bin/piwik-log-import.sh Inhalt #!/bin/bash /piwik/misc/log-analytics/import_logs.py --url=http:///piwik /$1 --idsite=$2 --recorders= --enable-http-errors --enable-http-redirects --enable-static --enable-bots --log-format-name=common_complete Nun noch natürlich ausführbar machen chmod a+x /usr/local/bin/piwik-log-import.sh In der ''/etc/crontab'' kann man nun folgende Einträge hinzufügen. ## Piwik 45 00 * * * www-data /usr/local/bin/piwik-log-import.sh 48 00 * * * www-data /usr/local/bin/piwik-log-import.sh ...