0

I have a file hosting site and I want to know what should be the apache log format/code to log records for only filesizes above 5mb that were served as download/output bandwidth

So log looks like this visitors_ip filepath(or filename) output bandwidth

One more thing data should be recorded ONLY FOR COMPLETED DOWNLOADS which I believe is checked through %X

I think output bandwidth is same as the filesize that was served as download if whole file is downloaded.

Thank You

1 Answer 1

2

i could be mistaken -- but i don't believe that Apache supports that kind of logic code inside its common logging.

It would probably be easier just to grep the logfile when you need access to this information, or just put it in the syslog rotate and dump it to a _bigfile.log or something.

.*\b([5-9]{7,}|[0-9]{8,})

should look for any lines that end with a 7-digit number starting with 5 or higher (such as 5mb or more), or any number longer then 8 digits.

there's probably more efficient ways of doing this

2
  • Thats really good idea. But can you help me more with logging only for completed downloads?
    – Shishant
    Mar 18, 2010 at 21:07
  • that's where things get really difficult -- Apache by default logs SIZE, not necessarily how much was transferred. If i have a 163mb file, and then cancel my download 10 seconds into the download (only having actually downloaded a portion of the file), the log still shows up as 171m bytes transferred. Typically i don't trust this level of logging for billing related measures.
    – grufftech
    Mar 18, 2010 at 21:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .