Skip to main content
  1. Blog Post/

How to measure complete file downloads with Urchin 6 or Urchin 7

2 min · 372 words

This time we're going to setup an Urchin profile, so we can track how many files are being fully downloaded .

The first step is to change the logformat that we're using to add a new variable to it, we are going to add  %X directive, according to Apache documentation it prints connection status when the response is completed

X =connection aborted before the response completed.
+ =connection may be kept alive after the response is sent.
- =connection will be closed after the response is sent.

(This directive was %c in late versions of Apache 1.3, but this conflicted with the historical ssl %{var}c syntax.)

More info: http://httpd.apache.org/docs/current/mod/mod_log_config.html

This will allow us to know if the file download have been completed or not, by default Urchin just tracks the status code of the requests, but Apache will return a 200 code even if the file has not been fully downloaded, it will even record that all bytes have been downloaded.

Just to avoid problems with Urchin logformat ( usually configured as auto ), we're going to append this data to Cookie value, like this:
LogFormat "%h %v %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"r_status=%X;%{Cookie}i\"" urchin

We only need to setup an advanced filter to extract the connection status value and then put it just before the request_stem

Now we should have 2 different entries for each file request, the first is going to tell us the download that have been succesfully finished, and then the count of aborted downloads.

Now we just need to use 2 simple regex to filter the top content report data:

To see finished downloads: ^/\+
Te see not finished downloads: ^/X