Re: ADRCI in 11g

From: Mladen Gogala <gogala.mladen_at_gmail.com>
Date: Sun, 11 Sep 2011 03:11:22 +0000 (UTC)
Message-ID: <pan.2011.09.11.03.11.22_at_gmail.com>



On Sat, 10 Sep 2011 17:55:06 -0700, The Magnet wrote:

> How is one to remove entries from the log.xml? We'll be putting this
> all into a shell script to help us manage / rotate the logs.

There is but one God and Larry is his prophet. Larry gave us the tool to do that, the pathologically eclectic rubbish lister. May the camel and the llama help you with your burden, my grasshopper.

#!/usr/bin/env perl
# CLEAN_LOG: This script removes all messages older than a week from
# log.xml in $DIAG_HOME/alert. 

use warnings;
use strict;
use Date::Simple qw(date today);
my $cutoff_date = today() - 7;
my $msg_date    = today() - 365;
my $out         = 0;

while (<>)
{

    if (!$out and /<msg time='(\d{4}-\d{2}-\d{2})T/)     {

        $msg_date = Date::Simple->new($1);
        $out = 1 if ($msg_date > $cutoff_date);
    }
    print $_ if $out;
}
[oracle_at_medo alert]$ ~/bin/clean_log log.xml >log1.xml
[oracle_at_medo alert]$ mv log1.xml log.xml
[oracle_at_medo alert]$ 



-- 
http://mgogala.byethost5.com
Received on Sat Sep 10 2011 - 22:11:22 CDT

Original text of this message