Link to home
Start Free TrialLog in
Avatar of bibi92
bibi92Flag for France

asked on

find the errors in a log

Hello,
I want to find the errors in a log over a number of days defined in parameter.
$LogFile = "C:\ORA\alert.log"
On the log 05/11/2021 09:00:49 ORA-00600

Thank you

Regards 
Avatar of Carol Chisholm
Carol Chisholm
Flag of Switzerland image

Something like this? I suppose you want it automated.

Shell script for monitoring Alert log DBACLASS 

Avatar of bibi92

ASKER

No I search how to get errors on last number od days passed in parameter.
Thank you
Best regards 
Avatar of oBdA
oBdA

Then you need to provide information about the exact format of a line that identifies an error.
Avatar of bibi92

ASKER

Hello,

On prompt specify the number lastdays, exAmple 3
$LogFile = "C:\ORA\alert.log"
On the log 05/06/2021 09:00:49 ORA-00600
On the log 05/07/2021 09:00:49 ORA-00600
On the log 05/08/2021 09:00:49 ORA-00600
On the log 05/09/2021 09:00:49 ORA-00600
On the log 05/10/2021 09:00:49 ORA-00600
On the log 05/11/2021 09:00:49 ORA-00600
Return only errors from 05/09/2021 and 05/11/2021

Thank you

Best regards 
Forgive me, but I somewhat doubt that the actual line in the log file reads
On the log 05/10/2021 09:00:49 ORA-00600

Open in new window

As this involves parsing strings, you need to provide exact sample lines.
So, again: among all the lines of the log file, how exactly can a line to be identified as "error"? Please provide some actual sample lines, taken straight from the log.
Easy way to do this will be to write a script which will...

1) Determine "now" (current date + time).

2) Subtract some number of days, using something like PERL's Date::Manip date calculator... something like this...
# Logical math, not actual code...
my $base = $now - 5 days;

Open in new window


3) Then craft code to parse + compare your date.

4) Print out any log line > $base ($now - $days to check).

Not overly complex code, just unique for every log format, so no... somehow... off the shelf tool that understands... every log format....

5) Fail2Ban can come close to this, so you might look into one of the many Windows ports of Fail2Ban.
Avatar of bibi92

ASKER

Hello,
Thank you the log contains every day the same error :
05/06/2021 09:00:49 ORA-00600: code d'erreur interne, arguments : [kdsgrp1], [], [], [], [], [], [], [], [], [], [], []
05/07/2021 09:00:49 ORA-00600: code d'erreur interne, arguments : [kdsgrp1], [], [], [], [], [], [], [], [], [], [], []
05/08/2021 09:00:49 ORA-00600: code d'erreur interne, arguments : [kdsgrp1], [], [], [], [], [], [], [], [], [], [], []
05/09/2021 09:00:49 ORA-00600: code d'erreur interne, arguments : [kdsgrp1], [], [], [], [], [], [], [], [], [], [], []
05/10/2021 09:00:49 ORA-00600: code d'erreur interne, arguments : [kdsgrp1], [], [], [], [], [], [], [], [], [], [], []
05/11/2021 09:00:49 ORA-00600: code d'erreur interne, arguments : [kdsgrp1], [], [], [], [], [], [], [], [], [], [], []

Thank you

regards
Now you need to solve the Oracle issue. Probably another set of people
https://support.oracle.com/knowledge/Oracle%20Database%20Products/1492150_1.html

Avatar of bibi92

ASKER

Hello,

Thank you it isn't the question. I have already open a case on Oracle Support for ORA-00600 but we need to monitoring error on alert.log

Best regards


ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial