Piwik is an open source Google Analytics like tool. Normally, it works by setting up piwik and adding a tracking code (JS or PHP or any code able to call the API) to record your site’s or app’s usage.
Another option is to use piwik to analyze your webserver’s logs to generate tracking infos for all your websites.

Here is how to set this up :

  1. Download the project : http://piwik.org/latest.zip
  2. Unzip the archive in your webroot
  3. Browse to yourserver.yourdomain.com/piwik (or the URL your setup piwik at).
  4. Follow the installation steps (database setup and first site creation). Follow the steps and click next on the code tracking page. We will not use this information in this setup.
  5. Once the setup is done, you need to run the script which will read the access.log file and generate usage data.
    The command looks like this

    python /path/to/piwik/misc/log-analytics/import_logs.py --url=http://yourserver.yourdomain.net/piwik --add-sites-new-hosts /var/log/apache2/other_vhosts_access.log

    Replace /var/log/apache2/other_vhosts_access.log with the path to your apache access.log or apache vhost access logs.

  6. Browse to your piwik installation again and you should see your stats.
  7. If everything works fine, you should add a daily task to run this script (using cron)
    crontab -e

    Add a line similar to

    0 6 * * *  python /path/to/piwik/misc/log-analytics/import_logs.py --url=http://yourserver.yourdomain.net/piwik --add-sites-new-hosts /var/log/apache2/other_vhosts_access.log
Note : 
If your piwik is setup in an admin vhost of your server you might get an Authentication Required message when running the script. You should modify your vhost and allow access from the server’s IP.
Satisfy Any</div>
<div>Allow from XX.XX.XX.XX</div>
That should be all. More information can be found in piwik’s official documentation.
Filed under: Computing, Système

Tagged with: , , , , ,

Liked this page?

Tweet it

Subscribe to the RSS feed or sign up for the newsletter now.

Posts related to Analyze your web server logs using Piwik

Name (required)

Email (required)


Leave a Reply

  • About Me

    photo of Samantha Halfon Samantha Halfon
    Software Engineer
    blueKiwi software
    Paris, France
    I enjoy playing with my computer(s), listening to Bob Dylan (and related artists) and watching movies (especially if they were directed by Martin Scorsese or John Cassavetes). Sometimes, I play a little guitar... If not doing any of the above, I am either riding a small red bike around Paris, or, making videos. About my videomaking please check out World Wide Angle and its blog.