www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@znep.com>
Subject mod_log-any/1396
Date Sun, 16 Nov 1997 01:30:00 GMT
The following reply was made to PR mod_log-any/1396; it has been noted by GNATS.

From: Marc Slemko <marcs@znep.com>
To: Apache bugs database <apbugs@apache.org>
Cc:  Subject: mod_log-any/1396
Date: Sat, 15 Nov 1997 18:09:51 -0700 (MST)

 ---------- Forwarded message ----------
 Date: Fri, 07 Nov 1997 09:02:29 -0800
 From: Steve Resnick <steve@ducksfeet.com>
 To: marcs@znep.com
 
 
 I posted this to my news server but am not entirely confident it gets
 propagated to the net very well. So, here goes: 
 
 This is using Apache 1.2.4 with mod_log_config under Solaris 2.5.1:
 
 
 I added/modified the following lines in my httpd.config file:
 
 TransferLog "|/usr/local/bin/logpipe <args>"
 LogFormat "%v %h %l %u %t \"%r\" %s %b"
 
 Then wrote a program (logpipe_ which reads the log input on stdin, writes
 all of it to a "master" file. Each record's first field (as the format above
 specifies) is the ip address of the virtual server being logged.
 
 At 5 minute intervals I write each virtual host's log data to a separate
 file. Once this operation is completed I save the file position of the
 master log, to be used to reposition the file at the next 5 minute write.
 This allows me to provide timely log data to customers at the same time
 allowing them to manipulate these files without breeching security or
 disturbing the server (since each virtual hosts' log is only opened when
 written to.)
 
 I hope this is enough background :)
 
 My problem, here, is that server does not seem to be able to serve pages
 properly when logging to this program via pipe. Some servers seem OK,
 others simply result in the browser griping about "Document contains no
 data"
 
 
 Is this, again, a resource limitation issue?
 Do I need larger buffering on the pipe (and can setvbuf handle this or
 do I need some sort of ioctl?)
 
 Do I need to fork() when I go to write the virtual server logs (thereby
 freeing up time for the pipe program.)
 
 The logic to read the data from the pipe and store it in a file is fairly
 simple:
 
    while(fgets(buf,1024,stdin))  {
       fputs(buf,s);
       fflush(s);
    }
 
 The five minute event is fired via SIGALRM by calling alarm(300).
 The problems I run in to are seen before the first SIGALARM signal is 
 received.
 
 When the SIGALARM *is* fired I do something like
 
 fseek(s,last,SEEK_SET);
 while(fgets(buf,size,s) 
 	writeLog(buf);
 
 writeLog: 
 	vhost = getFileNameForVhost(buf)	// derive file name from 
 						// vhost id in log data
 	if((f=fopen(vhost,"a+")) != NULL) {
 		fputs(buf,f);
 		fclose(f);
 	}
 
 This is somewhat simplified but covers the basics. 
 
 If neccessary I can provide source to this beastie; My intent though is
 not to throw mycode up to the net and say "Here, debug this for me" -- I
 would rather have a firm(er?) understanding of what's going on. :)
 
 One final note: This works with the same web server configuration on my
 linux box, however, my linux box sits on a lan at my house with a 28.8k
 connection to the net so I do not get the same sort of traffic to the
 servers; It's not 
 a good real world test case. 
 
 Any thoughts are appreciated.
 
 Cheers,
 Steve
 
 
 

Mime
View raw message