blue_cowdawg has asked for the wisdom of the Perl Monks concerning the following question:
Hey monks,
I was just presented with a very interesting problem that I think Perl might be able to solve, but I'm not 100% sure how to do it.
We have several processes on our production web application servers that spew to stdout. Currently we have stdout being redirected by our startup scripts for these processes to log files that when something goes wrong with the applications that run on top of these processes the developers review for errors.
The problem with this situation is two-fold.
What schemes have others used to be able to rotate logs? Am I making this too complicated and is it as simple as:
or should I be thinking of other stuff besides?#!/usr/bin/perl -w use strict; # starting psuedo-code while(my $line=<>){ print LOG $line; if file is too big... close LOG rename file open LOG } }
| Peter L. Berghold -- Unix Professional Peter at Berghold dot Net | |
| Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice. | |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Log rotating filter.
by merlyn (Sage) on Jan 30, 2004 at 17:51 UTC | |
by cees (Curate) on Jan 30, 2004 at 21:20 UTC | |
|
Re: Log rotating filter.
by arden (Curate) on Jan 30, 2004 at 18:01 UTC | |
|
Re: Log rotating filter.
by sfink (Deacon) on Jan 30, 2004 at 17:59 UTC | |
|
Re: Log rotating filter.
by Anonymous Monk on Jan 31, 2004 at 00:21 UTC | |
|
Re: Log rotating filter.
by waswas-fng (Curate) on Jan 30, 2004 at 22:37 UTC |