Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 2 down vote accepted

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.


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

share|improve this answer
Thats really good idea. But can you help me more with logging only for completed downloads? – Shishant Mar 18 '10 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 '10 at 21:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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