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_action
directive 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
sqlite
database and read data from there. - Use
rrdtool
to 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.
if you can log your accesses to a different log file, you should also be able to specify the format of the log file and awstats should be able to process the log and is cronjob'able so can regularly process the results and will have reasonably decent statistics for you
if you want to do funky graphing however (awstats only does basic bars) then you will need something else