Java stack trace parser in awk

I want the developers to get a mail with Java stack traces on a daily bases. When something is flaged as known issue and will get a fix but mean while this does not need to get sent each dayl. This is what I got so far. It's a bash script that runs some AWK in it.

To get the files that needs to be parsed

WORK_LOG="$(find $APP_DATA/log/ -maxdepth 1 -newermt "1 days ago" ! -newermt "00:00")"

This is working. All stack traces contains "exception:" string and can be x lines untill a INFO log message accurs and we stop printing.

awk '/excepeion\:/{p=1;print;next} p&&/UTC Level INFO Scope/{p=0};p' $WORK_LOG  #>> output_test.log

Now what I need is to get rid of line containing known errors string so next part of awk don't catch them. I will give developers ability to paste strings that will be ignored into a config file

KNOW_EXCEPTION1="known error"

What I'm trying to do is get awk to remove the known exception rows before the print from here to here part.

awk '!/'"$KNOW_EXCEPTION1"'/{print $1} /excepeion\:/{p=1;print;next} p&&/UTC Level INFO Scope/{p=0};p'$WORK_LOG  >> output_test.log

This I found through google but I need to work it into what I already have and I can't get it to work.

awk '!/known error/'
awk -v exc="${KNOW_EXCEPTION1}" '$0 !~ exc ........

How should I tie these together? I know a patter can follow another patter with a space but I'm getting syntax error if I do what you wrote.

awk -v exc="${KNOW_EXCEPTION1}" '$0 !~ exc  /excepeion\:/{p=1;print;next} p&&/UTC Level INFO Scope/{p=0};p' $WORK_LOG 
awk: $0 !~ exc /excepeion\:/{p=1;print;next} p&&/UTC Level INFO Scope/{p=0};p
awk:                     ^ backslash not last character on line
awk -v exc="${KNOW_EXCEPTION1}" '$0 !~ exc && /excepeion:/{p=1;print;next} p&&/UTC Level INFO Scope/{p=0};p' $WORK_LOG

Do you have 2 patterns that wou;d like to OR and do the action?

Maybe sth along this line (untested):

awk     'NR==FNR                {KnErr[$0]; next}
         /exception/            {for (k in KnErr) if ($0 ~ k) next
                                 P=1
                                }
         /UTC Level INFO Scope/ {P=0}
         P
        ' known_errors.conf $WORK_LOG

I want it to first remove the known exception rows before the next part works it's magic and prints the "wanted" exceptions

So first this

$0 !~ exc

and THEN do

/exception\:/{p=1;print;next} p&&/UTC Level INFO Scope/{p=0};p

I guess what I had last should work. Try it and let us know.