TransferLog pipe

TransferLog pipe

Post by Arpad Gell » Wed, 11 Jun 1997 04:00:00



Here's a problem that probably takes a simple answer. Something I've
overlooked.  I want to pass logging information to a perl script.

I have:

TransferLog "| /usr/local/etc/httpd/cgi-bin/script.cgi"

and:

#! /usr/local/bin/perl

open (FILE, ">>/usr/local/bin/logs/file");


        print FILE;

Quote:}

close (FILE);

exit 0;

What I get is "Document Contains No Data" from the Browser and
"Lost connection with machine.com" in the error_log.

Any suggestions?

It all works fine if I just change TransferLog to:
TransferLog /usr/local/etc/httpd/logs/file

instead of having the pipe but I want to operate on the log info
on the fly with Perl.

Thanks.

David Geller

 
 
 

TransferLog pipe

Post by Marc Slemk » Wed, 11 Jun 1997 04:00:00


Erm... the script is not started once for each log entry, and it is
not passed the information on the command line.

An example script:

#!/usr/local/bin/perl

open (FILE, ">>/tmp/log.out");
while (<>) {
        print FILE "GOT: $_";

Quote:}

close (FILE);

Note that you probably won't see anything in the file until either
a bunch of requests have gone by or you kill or restart the server
because of perl's buffering.  Also note that the program runs as root,
so you need to be very careful what you do.  Doing something silly like
what the above sample does (ie. writing to a world writable directory)
is a gaping security hole that gives easy root in most cases.


>Here's a problem that probably takes a simple answer. Something I've
>overlooked.  I want to pass logging information to a perl script.
>I have:
>TransferLog "| /usr/local/etc/httpd/cgi-bin/script.cgi"
>and:
>#! /usr/local/bin/perl
>open (FILE, ">>/usr/local/bin/logs/file");

>    print FILE;
>}
>close (FILE);
>exit 0;
>What I get is "Document Contains No Data" from the Browser and
>"Lost connection with machine.com" in the error_log.
>Any suggestions?
>It all works fine if I just change TransferLog to:
>TransferLog /usr/local/etc/httpd/logs/file
>instead of having the pipe but I want to operate on the log info
>on the fly with Perl.
>Thanks.
>David Geller



 
 
 

TransferLog pipe

Post by Arpad Gell » Wed, 11 Jun 1997 04:00:00


My apologies, I'm using Apache 1.2.0.


>Here's a problem that probably takes a simple answer. Something I've
>overlooked.  I want to pass logging information to a perl script.

>I have (in httpd.conf):

>TransferLog "| /usr/local/etc/httpd/cgi-bin/script.cgi"

>and (as script.cgi):

>#! /usr/local/bin/perl

>open (FILE, ">>/usr/local/bin/logs/file");


>        print FILE;
>}

>close (FILE);

>exit 0;

>What I get is "Document Contains No Data" from the Browser and
>"Lost connection with machine.com" in the error_log.

>Any suggestions?

>It all works fine if I just change TransferLog to:
>TransferLog /usr/local/etc/httpd/logs/file

>instead of having the pipe but I want to operate on the log info
>on the fly with Perl.

>Thanks.

>David Geller


 
 
 

1. Apache 1.2.0: TransferLog pipe -- still having problems

I'm trying to apply the following directive (in httpd.conf):
(using Apache 1.2.0)

TransferLog "| /usr/local/httpd/cgi-bin/script.cgi"

With the following (script.cgi):

#! /usr/local/bin/perl
open (FILE, ">>/usr/local/etc/httpd/logs/perl_log");
while (<>) {
        print FILE;
close (FILE);
exit 0;

The problem is that the file NEVER writes regardless of whether I shutdown  
or restart the server. The file does get created but it always stays  
empty.

Any ideas?

David Geller

2. what can i do for communicating between two process

3. TransferLog pipe

4. Networking/uucp/uugetty questions

5. feeding Apache TransferLog into pipe

6. why doesn't the werase key work?

7. dump pipe gzip pipe ssh pipe dd... blocksize?

8. blocking hotlinked images with mod_rewrite

9. Problems with Start Apache 1.2.0 ==> Invalid command TransferLog

10. rotatelog command and CustomLog / TransferLog

11. Apache, httpd.conf, transferLog: Limiting certain files from being logged

12. Apache Transferlog Limit GET

13. Apache TransferLog upload count?