My problem
I have a debian squeeze installation running nginx as my webserver and handling PHP5 requests using php-fpm, which works fine. I have one directory, which holds static zip files of a program in different versions. What I would like to have is a nice download statistics about which file was downloaded how often. I am not sure what would be the best way to implement it. I have set up a separate location block in my configuration file to log these downloads separately.
Acquiring raw data
For the acquisition of the raw data, meaning the download numbers I have two possibilities in mind:
- Using a script written in perl to parse the log files on a regular basis.
- Using the
post_actiondirective in my separate location block to trigger a logging script when the download has finished.
Processing the data
To process and log the data I could imaging using different tools:
- Store the values like filename and download times in a
sqlitedatabase and read data from there. - Use
rrdtoolto directly store the data in a round-robin manner which would also make generating graphs very easy.
There is another possibility of making all the above steps obsolete, but I do not know if it could work out. I am using google analytics for this site, could I somehow log these download numbers with this? By doing this I would not have to implement anything.