Aug 18, 2011
tom

Complex Apache Logging

Question

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

Answer

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.

.*b([5-9]{7,}|[0-9]{8,})

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

Related posts:

  1. apache logs: out of order logging
  2. Apache logging to different files by response code
  3. Logging HTTPS hits before they complete with Apache
  4. Apache Remote Logging
  5. Apache load balancer logging question

Leave a comment