LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

RE: problem with access_log & nfs on LVS setup

To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: problem with access_log & nfs on LVS setup
From: Alois Treindl <alois@xxxxxxxx>
Date: Fri, 18 May 2001 20:26:46 +0200 (METDST)
On Fri, 18 May 2001, Webstream Technical Support wrote:

> Anyone?
> 
> 
> -----Original Message-----
> From: lvs-users-admin@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:lvs-users-admin@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Webstream
> Technical Support
> Sent: Thursday, May 17, 2001 6:40 PM
> To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
> Subject: problem with access_log & nfs on LVS setup
> 
> 
> This is not a specific LVS problem, but I am hoping someone else has run
> into this problem and solved it:
> I am having a problem with my access_logs on a shared NFS directory in an
> LVS setup.
> I've got 1 host and 2 real servers. Each Real Server has the default Red Hat
> Apache installation (ver 1.3.12-25).
> Ive got the 2nd server acting as an NFS server serving out a directory
> called /logs.
> The 1st acts as a client and mounts that drive. I have apache on the 1st
> card saving the access_log file for each site into that directory as
> access1.log. The 2nd server saves it as access2.log in the same directory.
> Our stats program on another server looks for *.log files in that directory.
> The problem is that whenever I access a site (basically browse through all
> the pages of a site), the 2nd card adds the access info into the access2.log
> file and everything is fine. The 1st card saves it to the access1.log file
> for a few seconds, then all of a sudden the file size goes down to 0 and its
> empty.
> Anyone know why this is doing this?
> I feel I have everything set right. I can write to the directory from the
> client no problem, and obviously so can Apache because the access1.log file
> fills up (I've viewed the file right before it gets truncated to 0, so I
> know it gets written to for sure).
> 

I am running a similar system, but with Linux 2.4.4 which has NFS version
3, which is supposed to have safe locking.
Earlier NFS version are said to have buggy file locking, and as Apache
must lock the access_log for each entry, this might be the cause of your
problem.

I have chosen not to use a shared access_log between the real servers,
i.e. not sharing it via NFS.
I share the documents directory and a lot else via NFS between
all realservers, but not the logfiles.

I use remote syslog logging to collect all access logs on one
server.

1. 
On server w1, which holds the collective access_log and error_log, I have
in /etc/syslog.conf the entry:
local0.=info /var/log/httpd/access_log
local0.err   /var/log/httpd/error_log

2.
on all other servers, I have an entry which sends the messages to w1:
local0.info     @w1
local0.err      @w1

3.
On all servers, I have in http.conf the entry:
CustomLog "|/usr/local/bin/http_logger" common

4.
and the utility http_logger, which sends the log messages to w1, contains:
#!/usr/bin/perl
# script: logger
use Sys::Syslog;
$SERVER_NAME = 'w1';
$FACILITY = 'local0';
$PRIORITY = 'info';
Sys::Syslog::setlogsock('unix');
openlog ($SERVER_NAME,'ndelay',$FACILITY);
while (<>) {
  chomp;
  syslog($PRIORITY,$_);
}
closelog;    

5.
I also to error_log logging to the same central server.
This is even easier, because Apache allows to configure in httpd.conf:
ErrorLog syslog:local0

On all realservers, except w1, thse log entries are sent to w1
by the syslog.conf given above.

I think it is superior to using NFS.
the access_log entries of course contain additional fields
in from of the Apache log lines, which originate from the
syslogd daemon.

It is also essential that the realservers are well synchonized,
so that the log entries appear in correct timestamp sequence.



<Prev in Thread] Current Thread [Next in Thread>