Skip to content

fix: stitch multi-line stack traces into one log event in observability-logs-openobserve#281

Open
TemRevil wants to merge 1 commit into
openchoreo:mainfrom
TemRevil:fix/openobserve-multiline-stacktraces
Open

fix: stitch multi-line stack traces into one log event in observability-logs-openobserve#281
TemRevil wants to merge 1 commit into
openchoreo:mainfrom
TemRevil:fix/openobserve-multiline-stacktraces

Conversation

@TemRevil

@TemRevil TemRevil commented Jul 10, 2026

Copy link
Copy Markdown

Purpose

Multi-line exceptions (a .NET FluentValidation.ValidationException, or a Java/Go/Python stack trace) emitted by a workload are shipped to OpenObserve as one record per physical line instead of one record per exception, so a single error is scattered across many records and continuation lines get inconsistent log levels. Fixes openchoreo/openchoreo#4150.

Approach

Follows the proposed fix in the issue, and mirrors #280 (the same fix for the opensearch module) so the sibling modules stay consistent:

  • Added a multiline filter between the tail input and the kubernetes filter, keyed on log content, using the built-in go, java, python parsers plus a custom dotnet parser (buffer On, flush_ms 2000).
  • Defined the dotnet [MULTILINE_PARSER] in parsers.conf — Fluent Bit has no built-in .NET parser. A comment documents how to add further custom parsers for formats the built-ins don't cover.

Verification

  • Checked the dotnet rules against a representative FluentValidation.ValidationException trace: the …Exception: … line matches start_state only, the at … / --- End of inner exception stack trace --- lines match cont only, and a following normal log line matches neither — so the exception is stitched into one record (level taken from the first line) and the next record starts cleanly.
  • Rendered template parses as valid YAML; resulting pipeline order is tail → multiline → kubernetes → http.

Summary by CodeRabbit

  • Bug Fixes
    • Improved log collection by combining multiline entries into complete messages.
    • Added support for multiline Go, Java, Python, and .NET stack traces.
    • Improved handling of .NET exceptions and continuation lines in collected logs.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@observability-logs-openobserve/helm/templates/fluent-bit/config.yaml`:
- Around line 89-90: Update the continuation regex in the “cont” rule to require
a word boundary or whitespace after “at” (for example, `at\s` or `\bat\b`),
while preserving the existing `--- End of` matching.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 016b99f0-4aee-41b8-ba3b-011b13be9a4f

📥 Commits

Reviewing files that changed from the base of the PR and between 397acdc and 3e003b8.

📒 Files selected for processing (1)
  • observability-logs-openobserve/helm/templates/fluent-bit/config.yaml

Comment on lines +89 to +90
rule "start_state" "/^.*Exception[:,].*$/" "cont"
rule "cont" "/^\s+(at|--- End of).*$/" "cont"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add a word boundary after at in the continuation regex to prevent false-positive matches.

The cont rule /^\s+(at|--- End of).*$/ matches any line starting with whitespace followed by the literal at, including non-stack-frame lines like atmosphere or attached. Since this only applies after an exception start line, real-world risk is low — but adding at\s (or \bat\b) is a one-character fix that prevents incorrect log grouping in edge cases.

🛡️ Proposed fix
-        rule          "cont"        "/^\s+(at|--- End of).*$/" "cont"
+        rule          "cont"        "/^\s+(at\s|--- End of).*$/" "cont"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
rule "start_state" "/^.*Exception[:,].*$/" "cont"
rule "cont" "/^\s+(at|--- End of).*$/" "cont"
rule "start_state" "/^.*Exception[:,].*$/" "cont"
rule "cont" "/^\s+(at\s|--- End of).*$/" "cont"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@observability-logs-openobserve/helm/templates/fluent-bit/config.yaml` around
lines 89 - 90, Update the continuation regex in the “cont” rule to require a
word boundary or whitespace after “at” (for example, `at\s` or `\bat\b`), while
preserving the existing `--- End of` matching.

…ty-logs-openobserve

The tail input only set 'multiline.parser docker, cri', which handles
the container-runtime partial-line protocol but never concatenates
application lines belonging to one stack trace, so each frame reached
OpenObserve as its own record with its own inferred level.

Add an application-level multiline filter (go, java, python built-ins
plus a custom dotnet parser) between the tail input and the kubernetes
filter, and document in parsers.conf how to extend the parser list for
formats not covered by the built-ins.

Signed-off-by: Tem Revil <temrevil@gmail.com>
@TemRevil TemRevil force-pushed the fix/openobserve-multiline-stacktraces branch from 3e003b8 to aa31194 Compare July 10, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stitch multi-line stack traces into a single log event in observability-logs-openobserve module

1 participant