httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aidan Cully <ai...@panix.com>
Subject opening error logs as virtual-host user
Date Thu, 03 Dec 1998 00:21:28 GMT
Hi, all..
I'd like to be able to open an ErrorLog file as the server_rec's
server_uid.  It looks to me like the open_error_logs() function is
always called as the user that starts apache (usually root), so adding
a seteuid() before and after opening the log would not be a problem,
and our production code is actually doing that now.  But, maintaining
the patch for every version of apache has sort of hampered the upgrade
process, and I'd like to submit the change back.  I've considered
writing a logger program, that basically looks like
main() {
    setuid(uid);
    while(fgets(infile))
	fputs(logfile);
}
but running several hundred of these on a webhost doesn't sound very
fun to me.  If there were a way to determine the virtual host that an
error occured under, that'd be something different, and I'd write the
one daemon to do it for everything.  But, it's much easier to just
overload the configuration so that something like 'ErrorLog
%/path/to/errlog' (note leading '%') would mean open the errlog as the
server uid.

So, which one sounds more interesting to you people:
1) Log the virtual-host along with the error,
2) Open the errorlog as the server user directly, or
3) Add a global error type, with VirtualHosts able to pass arguments
   to the global process,
where the third one might look something like
AddLogger log |/usr/local/bin/http_logger
ErrorLog %log:default
<VirtualHost 10.0.0.1>
	ServerName "server"
	ErrorLog %log:server
</VirtualHost>
and lines passed to the program would look like
<default>	[Wed Dec  2 18:37:53 1998] access to /document.html failed for some.host,
reason: File does not exist

I'm kind of leaning towards the third, but I don't know how large a
change it'd end up being..

Let me know, I'll start working.
--aidan

Mime
View raw message