Skip to content

fix(detect_exceptions): use targeted patterns instead of catch-all for Java continuations - #304

Open
vparfonov wants to merge 1 commit into
ViaQ:v0.54.0-rhfrom
vparfonov:log9963-v0.54.0-rh
Open

fix(detect_exceptions): use targeted patterns instead of catch-all for Java continuations#304
vparfonov wants to merge 1 commit into
ViaQ:v0.54.0-rhfrom
vparfonov:log9963-v0.54.0-rh

Conversation

@vparfonov

Copy link
Copy Markdown

Summary

Fix incorrect multiline exception detection that was merging independent JSON log records (LOG-9963) while ensuring proper grouping of legitimate multi-line exceptions including Java exceptions with non-indented continuation lines like Oracle ORA errors (LOG-9995).

Problem

The detect_exceptions transform was using a catch-all regex pattern ^.+$ to match continuation lines of Java exceptions. This pattern was too greedy and would match ANY non-empty line after an exception keyword, causing independent log records to be incorrectly merged into a single event.

Example:

SecretConfigException: config error       ← matches exception keyword, StartTrace
Request completed in 235ms                ← matches ^.+$, merged as continuation
DatabaseError: connection exhausted       ← merged, should be separate

Result: 3 independent messages merged into 1 event

Solution

Replace the generic catch-all with 3 targeted continuation patterns that handle legitimate multi-line scenarios without matching arbitrary text:

  1. ^[A-Z]+-?\d+ — Oracle ORA errors, DB error codes
  2. ^[\t ]*\( — parenthetical continuations
  3. ^[\t ]+\S — indented lines (standard stack frames)

This allows proper grouping of:

  • Java stack traces with indented at frames
  • ORA error codes and connection IDs
  • Nested exceptions and Caused by: chains
  • Ruby stack traces

While preventing merger of:

  • Independent JSON log messages with exception keywords
  • Non-exception log lines that happen to follow exception-like text

Fixes

  • LOG-9963: JSON log records with exception keywords no longer merged
  • LOG-9995: Java exceptions with non-indented continuation lines properly grouped

@openshift-ci
openshift-ci Bot requested review from Clee2691 and jcantrill September 1, 2026 19:51
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: a68f1aab-8928-4dfc-8ffd-85f78d941c5e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@vparfonov

Copy link
Copy Markdown
Author

/assign @jcantrill

@vparfonov

Copy link
Copy Markdown
Author

/hold

@jcantrill jcantrill left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@openshift-ci

openshift-ci Bot commented Sep 2, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcantrill, vparfonov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved label Sep 2, 2026
@jcantrill

Copy link
Copy Markdown
Member

/retest

1 similar comment
@vparfonov

Copy link
Copy Markdown
Author

/retest

…r Java continuations

Replace the generic catch-all rule (^.+$) with targeted continuation
patterns that handle non-indented lines between exception headers and
stack traces (LOG-9995) without greedily consuming independent JSON
log records (LOG-9963).

The catch-all caused detectMultilineException to merge unrelated
single-line JSON logs into one event whenever a message contained an
exception keyword like "Exception:" or "Error:".

Targeted patterns added:
- ^[A-Z]+-?\d+       error codes (ORA-12521, TNS-xxxxx)
- ^[\t ]*\(           parenthesized lines (CONNECTION_ID=...)
- ^[\t ]+\S           indented non-stack-frame lines

Ref: LOG-9963, LOG-9995

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Vitalii Parfonov <vparfono@redhat.com>
@vparfonov

Copy link
Copy Markdown
Author

/hold cancel

@vparfonov

Copy link
Copy Markdown
Author

/test clo-functional

@vparfonov

Copy link
Copy Markdown
Author

/hold

@jcantrill

Copy link
Copy Markdown
Member

/hold

Code freeze for 6.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants