Re: oracle11 logs, the sequel.
Date: Tue, 15 Jan 2008 10:09:52 -0800 (PST)
On Jan 15, 6:58 am, Mladen Gogala <mgog..._at_yahoo.com> wrote:
> Oracle RDBMS 188.8.131.52 maintains XML version of alert_$ORACLE_SID.log,
> in addition to the ASCII one. Some of you might remember that log files
> are inclined to grow. To prevent endless growth which would fill up my
> disk space, I use logadm on Solaris and logrotate on Linux. I can do
> that on the ASCII version only because it doesn't have any kind of an
> internal structure. The award winning question is what to do about the
> XML version? If I let logrotate cut it weekly, I will end up with a
> useless XML file which I cannot validate or parse. It will require a
> manual intervention to make it into a proper XML file again. On the other
> hand, if I don't cut it with logrotate, it will grow like a sequoia in
> a vase, with similar consequences.
> The award winning question is what to do about that? How can I slice &
> dice the log.xml file while preserving its usefulness? This file is
> extremely useful because it contains the exact timestamp for every
> message. An entry looks like this:
> <msg time='2008-01-14T22:01:40.698+01:00' org_id='oracle' comp_id='rdbms'
> client_id='' type='UNKNOWN' level='16'
> module='' pid='25495'>
> <txt>Thread 1 advanced to log sequence 535
> That provides, timestamp, component and message text, for every message.
Just thinking out loud:
Could you use your favorite tool to parse it into single lines ending with the </msg>, tail some configurable number of lines, then parse back breaking lines on a space less than 78 or \>$?
Or maybe easier, logrotate, then figure out where the first complete </ msg> is, head that to the archived file (if you are keeping one), and tail everything after that for the new one.
I think the latter might be faster, I'm not sure about race issues with oracle writing the logs.
-- @home.com is bogus. "My RSS Reader is Empty!" - Alex GorbachevReceived on Tue Jan 15 2008 - 12:09:52 CST