httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <>
Subject Re: [users@httpd] logging php usage and directory index pages
Date Mon, 12 Nov 2007 01:07:59 GMT
On Nov 11, 2007 7:43 PM, Alex Dean <> wrote:

> >>> 2. Can I log the actual file that was served, even for directory indexes?
> >>>
> >>> I've tried the '%f' log format, and for requests, I get
> >>> a log of '/var/www/'.  If the directory index file was
> >>> 'index.html', I'd like '/var/www/' to get into
> >>> the log somehow.
> >
> > I don't believe that is possible. There are many ways that a request
> > can get mapped to a file, so there is no way for apache to determine
> > definitively what has happened. You can take a look at the different
> > available environment variables (using a printenv cgi script) and try
> > turning RewriteEnging On, which sets a few extra variables.
> But one way or another Apache has to actually read a file off the disk
> (or cache) and send it to the client.  Apache doesn't expose that
> through logging directives?
> It's exactly because there are so many ways that a file can be accessed
> (DirectoryIndex, Rewrite rules, etc) that I'm looking for a better
> answer than just the URL that was requested.

One problem here is that these is really no such thing as "an" apache.
Apache is a modular server that can be configured to access files in
dozens of different ways depending on the modules loaded. It would be
theoretically possible to develop an API for all these modules to
report back exactly where they grabbed a file (but such an API doesn't
currently exist). But then you have the additional problem that the
question "What file was retrieved from disk?" doesn't necessarily have
a clear answer. Responses can easily mix several files, with some
included as-is, others having filters applied, etc.

I would agree, however, that it would be nice if it was possible to
know exactly what file was served when the serving is done by apache's
core handler. There may indeed be a way to do this, but if it isn't in
the list of available environment variables, then I don't know what it


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message