RE: looking at alert log

From: Mark W. Farnham <mwf_at_rsiz.com>
Date: Sat, 19 Nov 2016 09:15:28 -0500
Message-ID: <031301d2426f$617eaae0$247c00a0$_at_rsiz.com>



That is a pipe, not a “wait until I’m done” and then dump output command. Both pipes and redirections “>” and “<” happen as soon as bytes dribble. If the sending program write flushes in a block size rather than each write being flushed, you CAN see a delay until the output buffer is full and flushes, but writing to the alert.log was either always individual flushed line writes or it became so by 1988.  

So the answer to your question is NO.  

If you wanted a single scrolling follow window AND routing the output further commands, you’d need to use something like tee as well to split standard out (and probably standard error as well).  

tail –f  

has been the standard lightweight (zero RDBMS engine load) way to manage filtering alert.log entries to something more urgent or a more selective repository (or both) since at least 1988.  

The other ways on the thread are also useful variants. Using tail –f is slightly more complicated in the general case for alert log since the advent of being able to rotate the log file (perhaps to a dated directory) without bouncing the database, but I believe it is still a very good way to do things as Yong Huang demonstrates in his example.  

And Niall’s note to use greater than instead of equals and a constant subtraction from current time answers the Brian’s question nicely and is useful especially when you are routing the results to yet another log in the database as your preferred means of keeping track of the exceptions you’ve selected for filtering.

mwf  

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Justin Mungal Sent: Friday, November 18, 2016 5:41 PM
To: dmarc-noreply_at_freelists.org
Cc: oracle-l-freelists
Subject: Re: looking at alert log  

Won't tail -f just continually "follow" the alert log, and thus not pass anything on to grep?  

On Fri, Nov 18, 2016 at 4:34 PM, Yong Huang <dmarc-noreply_at_freelists.org> wrote:

Brian,

Instead of reading the entire alert.log, which could grow big, why not read the tail?

tail -f alert.log | grep pattern

I have a fairly sophiscated example (called ck_alert_log.sh) at http://yong321.freeshell.org/computer/logfile.html

The `tail -f' command uses near-zero CPU and I/O, regardless the size of alert.log, and can immediately notify you of an error (if the command is piped to mail),

If you must do this with SQL, x$dbgalertext is the table you need to query as others have suggested. Or v$diag_alert_ext, which is the ADR version, and is slower. Alternatively, create an external table based on alert.log. But you can't read from the tail of the file.

Yong

Zelli, Brian wrote:

> I am running this script to check the alert log for errors and it runs every few minutes.
> How can I just look at the last few minutes as opposed to the entire day?

--
http://www.freelists.org/webpage/oracle-l



 



--
http://www.freelists.org/webpage/oracle-l
Received on Sat Nov 19 2016 - 15:15:28 CET

Original text of this message