Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot, bind-address mysql multiple, sanibleone xxxx, ftp://192.168.100.100/, www.xxxcon, which comes first ob_start or session, wwwxxx/58/2010

Links

XODOX
Impressum

#1: logging php usage and directory index pages

Posted on 2007-11-07 18:48:34 by Alex

Two questions about logging:

1. Can I log whether or not the current request was operated on by mod_php?

I want to determine what % of my requests are PHP. I've tried to
determine this based on filename, but with ForceType and other
configuration directives, it's possible for a file to be parsed as PHP
even if it doesn't have the .php file extension.

I saw the log formatter "%...{Foobar}n The contents of note Foobar
from another module.", and that sounds promising, but I'm really not
sure what it means, or what value I might use for {Foobar}.
http://httpd.apache.org/docs/2.0/mod/mod_log_config.html#for mats

2. Can I log the actual file that was served, even for directory indexes?

I've tried the '%f' log format, and for http://site.com requests, I
get a log of '/var/www/site.com/htdocs/'. If the directory index file
was 'index.html', I'd like '/var/www/site.com/htdocs/index.html' to
get into the log somehow.

thanks,
alex

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Report this message

#2: Re: logging php usage and directory index pages

Posted on 2007-11-11 18:21:56 by Alex Dean

Can anyone help with this?

alex@crackpot.org wrote:
> Two questions about logging:
>
> 1. Can I log whether or not the current request was operated on by mod_php?
>
> I want to determine what % of my requests are PHP. I've tried to
> determine this based on filename, but with ForceType and other
> configuration directives, it's possible for a file to be parsed as PHP
> even if it doesn't have the .php file extension.
>
> I saw the log formatter "%...{Foobar}n The contents of note Foobar
> from another module.", and that sounds promising, but I'm really not
> sure what it means, or what value I might use for {Foobar}.
> http://httpd.apache.org/docs/2.0/mod/mod_log_config.html#for mats
>
> 2. Can I log the actual file that was served, even for directory indexes?
>
> I've tried the '%f' log format, and for http://site.com requests, I get
> a log of '/var/www/site.com/htdocs/'. If the directory index file was
> 'index.html', I'd like '/var/www/site.com/htdocs/index.html' to get into
> the log somehow.


------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Report this message

#3: Re: logging php usage and directory index pages

Posted on 2007-11-11 19:08:14 by Joshua Slive

On Nov 11, 2007 12:21 PM, Alex Dean <alex@crackpot.org> wrote:
> Can anyone help with this?
>
> alex@crackpot.org wrote:
> > Two questions about logging:
> >
> > 1. Can I log whether or not the current request was operated on by mod_php?
> >
> > I want to determine what % of my requests are PHP. I've tried to
> > determine this based on filename, but with ForceType and other
> > configuration directives, it's possible for a file to be parsed as PHP
> > even if it doesn't have the .php file extension.
> >
> > I saw the log formatter "%...{Foobar}n The contents of note Foobar
> > from another module.", and that sounds promising, but I'm really not
> > sure what it means, or what value I might use for {Foobar}.
> > http://httpd.apache.org/docs/2.0/mod/mod_log_config.html#for mats

I believe php adds a special http response header to its requests
(X-Powered-By: php or something like that). You can log that.

> >
> > 2. Can I log the actual file that was served, even for directory indexes?
> >
> > I've tried the '%f' log format, and for http://site.com requests, I get
> > a log of '/var/www/site.com/htdocs/'. If the directory index file was
> > 'index.html', I'd like '/var/www/site.com/htdocs/index.html' 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.

Joshua.

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Report this message

#4: Re: logging php usage and directory index pages

Posted on 2007-11-12 01:43:44 by Alex Dean

Joshua Slive wrote:
> On Nov 11, 2007 12:21 PM, Alex Dean <alex@crackpot.org> wrote:
>> Can anyone help with this?
>>
>> alex@crackpot.org wrote:
>>> Two questions about logging:
>>>
>>> 1. Can I log whether or not the current request was operated on by mod_php?
>>>
>>> I want to determine what % of my requests are PHP. I've tried to
>>> determine this based on filename, but with ForceType and other
>>> configuration directives, it's possible for a file to be parsed as PHP
>>> even if it doesn't have the .php file extension.
>>>
>>> I saw the log formatter "%...{Foobar}n The contents of note Foobar
>>> from another module.", and that sounds promising, but I'm really not
>>> sure what it means, or what value I might use for {Foobar}.
>>> http://httpd.apache.org/docs/2.0/mod/mod_log_config.html#for mats
>
> I believe php adds a special http response header to its requests
> (X-Powered-By: php or something like that). You can log that.

That's exactly what I needed. Thanks!


>>> 2. Can I log the actual file that was served, even for directory indexes?
>>>
>>> I've tried the '%f' log format, and for http://site.com requests, I get
>>> a log of '/var/www/site.com/htdocs/'. If the directory index file was
>>> 'index.html', I'd like '/var/www/site.com/htdocs/index.html' 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.

thanks,
alex

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Report this message

#5: Re: logging php usage and directory index pages

Posted on 2007-11-12 02:07:59 by Joshua Slive

On Nov 11, 2007 7:43 PM, Alex Dean <alex@crackpot.org> wrote:

> >>> 2. Can I log the actual file that was served, even for directory indexes?
> >>>
> >>> I've tried the '%f' log format, and for http://site.com requests, I get
> >>> a log of '/var/www/site.com/htdocs/'. If the directory index file was
> >>> 'index.html', I'd like '/var/www/site.com/htdocs/index.html' 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
is.

Joshua.

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Report this message