More Uses for Generic Apache Logging

In my last post, I showed how it was possible to fix Apache logging so that it would properly log client IPs accessing a back-end through a reverse proxy. It turns out that logging request headers in that fashion can be handy in other contexts as well. Last night, while debugging a vexing and time-sensitive software issue, we found the need to figure out how large the payload of a POST operation was. The normal combined┬álog format only shows the amount of data returned to the client, so I needed to start hacking again. It turns out that the Content-Length header that’s set during POSTs was just what we needed. I just added the following to our LogFormat directive, and we started getting the data we were looking for.


Note that the “CL:” bit is just to make a distinction between the Content-Length size and other arbitrary numerical fields I’ve added to on to that logging format. It’s just a label, and not necessary to make things work.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>