views:

202

answers:

2

If a user requests a large file from an Apache web server, but cancels the download before it completes, is this logged by Apache?

Can I tell from the log file which responses were not sent fully, and how many bytes were sent?

A: 

Yes. If I remember correctly, it will show the amount of bytes transferred before the download was interrupted. You could then work out how many bytes should have been sent for that request and compare.

If you're using PHP (as the question was tagged a minute ago), you could probably do some sort of response buffer, where you chunk out the file in smaller bits. Start off by working out how many chunks you need to send, write a log (to db, or the syslog) to say you've started and once you hit the final chunk, another to say you've finished (or delete the first).

Oli
+3  A: 

Yes, it logs those requests, but you need to use mod_logio to know the actual bytes sent, else it will show the total amount of bytes of the file. And to know which have failed you'd have to either:

  • use the %X format modifier and use a custom log format
  • compare the actual bytes sent against the files' sizes (why would you if you have the first option :-) )
Vinko Vrsalovic