Regex to filter error codes
Posted: Wed Mar 07, 2007 3:44 am
One of the systems I support scans through oracle and siebel error logs (using perl), and raises alerts for errors that are not known.
EDIT: Just to add that this does work; however I just wanted to ask if anyone can see any loopholes where an error message in the below format could slip through.
Can anyone see any flaws in the regex? I've tested to a certain degree but am out of ideas. The errors are always, for example:
or:and the message is not always at the start of the line. I've been instructed to add an allowance of certain errors (despite my concerns that it is bad practice .. ) thus the use of a regex to test the type of error as well as the error message itself.
EDIT: Just to add that this does work; however I just wanted to ask if anyone can see any loopholes where an error message in the below format could slip through.
Code: Select all
while (<OUTPUTFILE>)
{
$permittedSBL = "00426|01042";
$permittedORA = "00000|00001";
if ( $_ =~ /(SBL-EIM-[0-9]{5}(?<!(?:$permittedSBL))|ORA-[0-9]{5}(?<!(?:$permittedORA)))/i )
{
push(@return, 8);
next;
}
if ( $_ =~ /Command completed successfully/i )
{
push(@return, 0);
next;
}
}Code: Select all
ORA-12345: Error messageCode: Select all
SBL-EIM-12345: Error Message