httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jsl...@gmail.com>
Subject Re: [users@httpd] custom apache logs
Date Thu, 01 Jul 2004 18:35:56 GMT
On Thu,  1 Jul 2004 13:25:30 -0400, Jim Maul <jmaul@elih.org> wrote:
> 
> I have read through the custom logs section of the apache documentation but i
> have been unable to determine if what i want to do is possible.
> 
> When using PHP auth with apache _SERVER['PHP_AUTH_USER'] used to get logged to
> apache's access log.  We have since switched to authenticating through a form
> and then using php sessions and have gotten rid of all instances of
> PHP_AUTH_USER.  Because of this, the currently logged in user is no longer
> logged to the apache access log.  Is there any way to have PHP variables
> recorded in the apache access log?  The currently logged in user is stored in
> _SESSION['UserName'].  Can i somehow write this to apache's log?

There are probably lots of different ways to do this.  The goal is to
get it into a variable that apache can log.  This could be a response
header, env variable, an apache "note", etc.

The last one seems the cleanest.  You can use the php apache_note
function to drop the username into a note using something like
apache_note("phpauth",_SESSION["UserName"]), and then use %{phpauth}n
in your logformat to put it in the logs.

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


Mime
View raw message