Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
go ahead... be a heretic
 
PerlMonks  

Re: Apache log pipe doesn't write to log files

by trs80 (Priest)
on Nov 10, 2002 at 06:57 UTC ( #211741=note: print w/ replies, xml ) Need Help??


in reply to Apache log pipe doesn't write to log files

I haven't tested this, but this is how I would write it based on what you have provided.

#!/usr/bin/perl use strict; # split-logfiles # you don't need to test if it is open #$isopen = 0; my $myfile = "/var/tmp/test.log"; # no reason to do this testing # unless($isopen and -f $myfile) { # open the happy file here, but you may want to use >> if # you need to append rather then overwrite on each run open MYHAPPYFILE, ">$myfile" or die "Error opening $myfile"; # don't need to test if it is open because we # are dying if it isn't # $isopen = 1; # } while (my $log_file = <STDIN>) { printf MYHAPPYFILE "%s", $log_line; } exit 0;
And without commments:
#!/usr/bin/perl use strict; my $myfile = "/var/tmp/test.log"; open MYHAPPYFILE, ">$myfile" or die "Error opening $myfile"; while (my $log_file = <STDIN>) { printf MYHAPPYFILE "%s", $log_line; } exit 0;


Comment on Re: Apache log pipe doesn't write to log files
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://211741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-04-20 05:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls