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:

  1. Using a script written in perl to parse the log files on a regular basis.
  2. 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:

  1. Store the values like filename and download times in a sqlite database and read data from there.
  2. 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

  • Thanks for your answer. As written in my question I am already logging the downloads separately to a different log file. Awstats would be a possibility but I do not like it as it seems a bit bloated. – GorillaPatch Apr 6 '11 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.