How to set piwik to use IIS logs


#1

I have installed latest version and all is working, but I cannot see how to get it to use the web server logs instead of tracking code, how do you do this ?


(Matthieu Aubry) #2

Hi there,

please check out the guide at: Log Analytics - Analytics Platform - Matomo


#3

I have tried following those docs, but when I run the python script nothing happens, no logs get imported. How does it even know where the log are ?

Also this seems very clunky to have to run this manually on the server to import the logs every day. I was really looking for something very simple plug and play like Smarterstats for customers to do basic log analysis. Having to setup and configure python and run scripts requires a lot more skill and knowledge than most website owners have.


#4

the last parameter gives the path/file name of the log to import.
http://piwik.org/docs/log-analytics-tool-how-to/


python /path/to/piwik/misc/log-analytics/import_logs.py --url=http://analytics.example.com 
--idsite=1234 --recorders=4 --enable-http-errors --enable-http-redirects --enable-static
--enable-bots [b]/path/to/historic/logfile/access.log[/b]

Can you provide the command you tried that yielding nothing happening?


#5

so are you saying that script has to be run manually for each log file individually that you want imported, so if there is 90 days worth of logs, we have to run that 90 days, and then also run it manually every day to import each days logs as well ?


#6

Yes, that would work. Automating the process is fairly easy.

I used a command like the following to concatenate all the log files first.


find /path/to/directory/ -name *.log -print0 | xargs -0 -I file cat file > merged2015.log

Then once up to date, going forward I have a script which grabs the log from the iis server, and imports that. This script is executed via a cron job in the early morning hours. No manual intervention necessary in my current set up. I did this to compare the iis logs to the same site analysed under a different site_id but tracked with the javascript tracker; quite satisfied so far, I’ll likely turn off the log import at some point.

[edit]
if you find your merged log file is huge, storing the log files down by month then combining each month may make sense. See the script posted by terdon for some help with that; would be possible to amend this script to create a merged file per month instead of moving them to subfolders.
http://superuser.com/questions/707261/shell-script-bash-moving-file-iterate-based-on-month#answer-707305


#7

Unfortunately this process is going to be way beyond most of our customers, and on the shared servers it wouldn’t even be possible as they wouldn’t have the ability to run the python scripts.

All I am looking for here is a simple webstats solution to recommend to clients which is simple to install and use to analyze their logs. Most everyone uses google Analytics these days anyway, so this is really just to cater for those that do not want to do that or want the historic data from old logs.
We have been using AWSTATS, but it is not pretty and has a tendency to break and is also a PITA to setup.


#8

Understood. I had tried several and landed on PIWIK as it was the only that reliably interpreted my IIS logs and was free. I have complete access to my servers and some ability to be able to automate the process; I agree - not everyone will have in-house resources for that.

Perhaps funding or suggesting a plug in that allows the user to provide the path to the historic logs or upload them would be beneficial. Using the hosted solution, with such a plug in may be acceptable to small to mid sized clients.