Prompt
How do I debug missing multiline stack traces in log ingestion?
Latest observation
Missing multiline stack traces in log ingestion usually come from one of four places:
- The app is not actually emitting them as one event
- The log shipper is splitting them incorrectly
- The parser/collector is failing to reassemble lines
- The backend/indexer is truncating or transforming them
Here’s a practical way to debug it.
1) Verify what the application is writing
Check the raw log file or stdout/stderr at the source.
- If the stack trace appears as multiple physical lines, your shipper must support multiline handling.
- If the application already emits JSON with escaped
\n, then multiline parsing may not be needed. - Confirm whether the logger writes to:
- a file
- stdout/stderr in containers
- syslog/journald
- a cloud logging agent
Goal: know whether the problem starts at emission or ingestion.
2) Compare raw source vs shipped event
Take one known exception and inspect:
- the original file or container output
- the event as received in the log platform
- the event after parsing/filtering
Look for:
- only the first line arriving
- subsequent lines becoming separate events
- stack trace joined but with missing lines
- truncation at a size limit
- newline characters escaped or removed
3) Check multiline configuration in the shipper
This is the most common failure.
Typical symptoms
- First line ingested as one event
- Each stack frame ingested as a separate event
- Exception line separated from the actual stack trace
What to review
- start/continue pattern
- timeout / flush interval
- max lines
- max bytes
- buffer size
- ordering guarantees
Common patterns:
- Start a new event on timestamp/log-level lines
- Continue event on lines that begin with whitespace
- Continue event on lines beginning with
at ... - Continue event until a blank line or next timestamp
Example heuristic:
- new event if line starts with a timestamp
- otherwise append to previous event
4) Confirm the parser isn’t stripping newlines
Some pipelines normalize or flatten messages.
Check for:
- regex extraction that only captures the first line
- JSON parser overwriting message fields
- filters that replace
\nwith spaces - grok patterns that do not allow multiline content
- line-oriented transport that assumes one event per line
If using JSON logs, confirm the stack trace is in a field that preserves escaped newlines.
5) Look for truncation limits
Stack traces can be cut off by:
- agent max event size
- collector buffer limits
- broker/message queue size
- backend field size limits
- UI/display truncation
If the first few lines appear, but the rest vanish:
- inspect raw payload size
- check agent and backend limits
- compare byte length of source vs ingested record
6) Test with a controlled sample
Create a known multiline message and send it through the same path.
Example:
2026-10-28 12:00:00 ERROR Failed to process request
java.lang.RuntimeException: boom
at com.example.Service.run(Service.java:42)
at com.example.App.main(App.java:10)
Then inspect:
- does it arrive as one record?
- are the lines preserved?
- does the backend display them properly?
This isolates whether the issue is configuration or data-specific.
7) Validate timestamps and log-level patterns
Multiline grouping often depends on recognizing the start of a new record.
If timestamps are:
- inconsistent
- missing
- localized
- wrapped differently
then the multiline parser may mis-group entries.
Similarly, if the exception line starts with a pattern that looks like a new log entry, it may be split.
8) Check container and platform-specific behavior
In Kubernetes/Docker:
- stdout/stderr are usually captured line-by-line
- multiline must often be handled by the log agent, not the app
- some agents support multiline only in file tailing mode, not container mode
- rotation can split events if the agent doesn’t handle file changes well
9) Reduce complexity in the pipeline
Temporarily disable:
- enrichment
- parsing
- JSON transforms
- regex filters
- reformatters
Then re-enable one by one. This helps find the stage where the stack trace disappears.
10) Use metrics/logging from the shipper
Many agents expose counters like:
- multiline events formed
- lines dropped
- buffer flushes
- parse errors
- truncated messages
These often point directly to the culprit.
Common root causes by tool type
- Filebeat / Elastic Agent: multiline regex or harvester settings
- Fluent Bit: multiline parser not enabled or wrong parser order
- Fluentd: concat filter misconfigured
- Logstash: codec/multiline setup wrong, especially with Beats input
- Vector: remap/transform flattening or multiline source misconfig
- Cloud agents: backend size limits or unsupported multiline mode
A simple debugging checklist
- Find one known stack trace at the source.
- Confirm exact raw text and line breaks.
- Verify shipper multiline settings.
- Check for size limits/truncation.
- Inspect the parsed event in the backend.
- Test with a minimal sample.
- Review shipper logs/metrics for parse errors.
If you want, I can also give you:
- a tool-specific checklist for Filebeat, Fluent Bit, Logstash, or Vector
- a sample multiline config
- a decision tree to identify where the stack trace is getting lost