You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John Saylor <jo...@worldwinner.com> on 2001/06/12 22:19:07 UTC
handler for error log
Hi
Is it possible to put a handler on the error log so that certain
elements could be filtered? Ideally, I'd like to keep track of how many
times a certain error appears and with a handler that would be a cake
walk. So the handler would 'live' between the main httpd process and the
file, doing it's magic there.
I've done some searching and found nothing [other than people
complaining about their CGI scripts].
Any pointers or suggestions are welcome.
--
\js
Wayne's World C Programming Style Guide:
A == B; !;
("A equals B. Not!")
Re: handler for error log
Posted by Steven Lembark <le...@wrkhors.com>.
> Is it possible to put a handler on the error log so that certain
> elements could be filtered? Ideally, I'd like to keep track of how
> many times a certain error appears and with a handler that would be a
> cake walk. So the handler would 'live' between the main httpd process
> and the file, doing it's magic there.
>
> I've done some searching and found nothing [other than people
> complaining about their CGI scripts].
>
> Any pointers or suggestions are welcome.
There are several log watchers avaialble, including ones written
in perl. One simple trick is to essentially tail -f the thing into a
regex. Quick way is to seek to the end, store -M $logfile and set
$\ = undef. After that:
open my $logfile, "< $logpath" or croak "$logpath: $!";
undef $\; # or leave it alone if reading into an array.
for( my $lastmod = -M $logfile ;;)
{
sleep 10 while( $lastmod == -M $logfile );
my $newstuff = <$logfile>;
# regex $newsuff to your heart's delight.
# that or read it as @newstuff and process it
# line by line
}
--
Steven Lembark
2930 W. Palmer
chicago, IL 60647
lembark@wrkhors.com
+1 800 762 1582
Re: handler for error log
Posted by Doug MacEachern <do...@covalent.net>.
On Tue, 12 Jun 2001, John Saylor wrote:
> Hi
>
> Is it possible to put a handler on the error log so that certain
> elements could be filtered? Ideally, I'd like to keep track of how many
> times a certain error appears and with a handler that would be a cake
> walk. So the handler would 'live' between the main httpd process and the
> file, doing it's magic there.
you can use a piped log to feed error_log output to a script. there are
no in-process error_log hooks for 1.x
see: http://httpd.apache.org/docs/mod/core.html#errorlog
"If the filename begins with a pipe (|) then it is assumed to be a command
to spawn to handle the error log."