Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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 drinking their drinks and smoking their pipes about the Monastery: (15)
As of 2015-07-02 19:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (45 votes), past polls