SigNoz Cloud - This page is relevant for SigNoz Cloud editions.
Self-Host - This page is relevant for self-hosted SigNoz editions.

Parsing Multiline Logs

Overview

By default, the filelog receiver treats each newline as the end of a log entry. This breaks stack traces, multi-line error messages, and other logs that span multiple lines into separate entries.

Here is an example of multiline logs:

2024-06-20 18:58:05,898 ERROR:Exception on main handler
Traceback (most recent call last):
File "python-logger.py", line 9, in make_log
  return area[10]
IndexError: string index out of range
2024-06-20 18:58:05,898 DEBUG:Query Started

The example above has two log entries spread over multiple lines. Since each newline is treated as the end of a log entry by default, the collector creates separate entries for each line:

Multiline logs as multiple individual log lines
Multiline logs as multiple individual log lines

Parse Multiline Logs at Receiver

The filelog receiver has a built-in multiline configuration block. This is the recommended approach because it recombines logs before they enter the pipeline.

Step 1: Identify the start or end pattern

Look at your log format and find a regex that matches the beginning (or end) of each log entry.

2024-06-20 18:58:05,898 ERROR:Exception on main handler
Traceback (most recent call last):
File "python-logger.py", line 9, in make_log
  return area[10]
IndexError: string index out of range
2024-06-20 18:58:05,898 DEBUG:Query Started

For the above log lines, each new entry starts with a date. The line_start_pattern would be:

^\d{4}-\d{2}-\d{2}

Step 2: Add the multiline configuration to your receiver

receivers:
  filelog:
    include:
      - /var/log/example/multiline.log
    multiline:
      line_start_pattern: ^\d{4}-\d{2}-\d{2}
    force_flush_period: 5s

The multiline block must contain exactly one of line_start_pattern or line_end_pattern. You can also set omit_pattern: true to exclude the matched pattern from the combined entry.

The filelog receiver waits for more content before flushing the last multiline entry. If your last log line never appears in SigNoz, set force_flush_period at the receiver level (default is 500ms). Example: force_flush_period: 5s.

Step 3: Enable the receiver in your logs pipeline

service:
  pipelines:
    logs:
      receivers: [filelog]
      processors: []
      exporters: [otlp]

Using multiline in the SigNoz k8s-infra Helm chart

If you are running SigNoz on Kubernetes with the k8s-infra Helm chart, use the presets.logsCollection.multiline key in your Helm values instead of editing the raw receiver config:

presets:
  logsCollection:
    multiline:
      line_start_pattern: '^\d{4}-\d{2}-\d{2}'

The preset propagates this directly to the filelog receiver's multiline block on the otelAgent DaemonSet. You do not need to touch otelAgent.config directly.

After deployment, multiline logs appear as single entries in SigNoz:

Multiline logs as a single individual log line
Multiline logs as a single individual log line

Validate

After applying either approach, verify in SigNoz that:

  1. Navigate to the Logs tab.
  2. Search for logs from the service you configured.
  3. Confirm that stack traces and multi-line entries appear as single log entries instead of fragmented lines.

Troubleshooting

All logs combined into one entry — Check that is_first_entry or line_start_pattern matches the correct pattern. If the regex is too broad or too narrow, entries will not split correctly.

logstransform processor causes collector startup error in k8s-infra — The logstransform processor is not included in the official otelcol-contrib image used by the k8s-infra chart. You will see unknown type: logstransform in the collector logs. Use presets.logsCollection.multiline in your Helm values instead (see the receiver section above).

Processor defined but not applied — Ensure the processor is listed in service.pipelines.logs.processors. Defining a processor alone does not enable it.

Next steps

Now that multiline logs are recombined properly, explore related log management features:

Get Help

If you need help with the steps in this topic, please reach out to us on SigNoz Community Slack.

If you are a SigNoz Cloud user, please use in product chat support located at the bottom right corner of your SigNoz instance or contact us at cloud-support@signoz.io.

Last updated: April 2, 2026

Edit on GitHub

Was this page helpful?

Your response helps us improve this page.