In the default log formats, the size of the response is logged using the %b directive in the log format string. This logs the size of the object requested by the client, but not necessarily the number of bytes actually delivered to the client. In other words, the log will contain exactly what is written in the Content-Length HTTP response header (for responses that use this header).

If you wish to instead log the number of bytes actually sent to the client, you should use the %O log format directive provided by mod_logio.

The difference between %b and %O will be especially large in cases where download accelerators are used. Download accelerators often make many simultaneous overlapping requests for the same object, using the Range header to request that the download start from someplace other than the beginning. When they receive what they want, they simply drop all the connections. The result is that the amount of content that Apache httpd believes it will send based on the requests (%b) winds up much larger than the amount of content actually sent (%O). This situation can be identified by looking for 206 Partial Content status codes in the logs.

  • No labels