2

I want to keep some statics about the files uploaded to my server, including the file name, size and response time.

I use PHP to handle the uploads in the server side (client-side is a POST form) but ideally I'd like to use Apache's logging facilities to collect the above-mentioned data. So, I'm trying to modify the default format for the access_log but I only found how to add the response time (using the %D formatter).

Is it possible to use Apache logs to monitor at least the size of POST requests and if possible the filenames of the uploaded files?

Vasilis
  • 293
  • 1
  • 4
  • 13

1 Answers1

3

As per the Apache documentation you want %I and mod_logio:

%I  Bytes received, including request and headers, cannot be zero. You need to enable mod_logio to use this.
%O  Bytes sent, including headers, cannot be zero. You need to enable mod_logio to use this.
Mark Henderson
  • 68,823
  • 31
  • 180
  • 259
  • Thanks, this is good for the upload size. The only problem remaining to solve is how to get the file name. – Vasilis Jan 07 '13 at 12:29
  • @Vasilis - this probably won't be possible from Apache itself, as it doesn't have any knowledge of what it inside the multipart upload. Determining the request size inc. headers is trivial, which is why it can do that. But for the filenames themselves, you will have to write some server-side logic to do that. E.g. you can combine form elements with files, or multiple files, or all sorts of things that Apache can't be expected to know what to do with. – Mark Henderson Jan 08 '13 at 02:11