[OpenAFS] Daemon logging to AFS-mounted logfile

Sven sven@dmv.com
Tue, 16 Jul 2002 08:45:42 -0400


> Date: Mon, 15 Jul 2002 23:19:11 +0200
> To: OpenAFS Info Mailing List <openafs-info@openafs.org>
> Subject: Re: [OpenAFS] Daemon logging to AFS-mounted logfile
> From: tino.schwarze@informatik.tu-chemnitz.de (Tino Schwarze)
>
> On Mon, Jul 15, 2002 at 04:48:17PM -0400, Sven wrote:
>
> > In trying to create a distributed file system to emulate clustering
> > (this will cluster a series of web servers together), I have come
> > across a problem in logging to a file that exists in the AFS space.
> > Using Solaris 9 and AFS compiled from the 2002-07-05 snapshot, I have
> > mounted the apache data, conf, and logging directories into a
> > RW-mounted directory. A total of 4 servers are currently being used in
> > our test setup. The problem is that when Server 2, for example, is
> > started, it opens a pipe to the log file; any writes to the logfile
> > are not "propogated" or released until the daemon is stopped
> > (effectively closing the data pipe). At that point, the log file is
> > visible in its entirety on the other servers.
>
> This is exactly one issue where AFS violates the Unix file system
> semantics. It's called write-on-close. You can also force the log file
> to show up by calling fsync() frequently.
>
> See "AFS Implements Save on Close" at
> http://www.openafs.org/pages/doc/frameless/AdminGuide/auagd007.htm
>

Using fsync() seems to be the general consensus. I have found that when one
instance of the apache daemon is running, using fsync() works fine. The
problem is when each of the other servers also run the apache daemon; the
data never gets flushed to the fileserver regardless of who is calling
fsync(). It looks like I will have to go with the syslog option or
maintaining separate logfiles and joining them after the fact (per David
Fulton's suggestion) ....

> > Is there a workaround for this, or am I limited to only having webpage
> > updates propogate throughout the system? These will be frontpage sites
> > so the file writing will be done by "nobody" or the apache daemon user
> > which I assume will not function in the same manner as logging.
>
> You might be able to use mod_auth_pam (I don't know the frontpage stuff)
> and have the server acquire a token on behalf of the user using
> PAM_SetCred.
>

Thanks for this .... I will look into it; I believe this is pretty much what
I was looking for.

Sven