Beefy Boxes and Bandwidth Generously Provided by pair Networks
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 ( [id://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;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2024-04-18 12:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found