How Dash0 Processes JSON Logs

Detailed description of JSON matching rules used in Dash0.

Preconditions

Dash0 only scans a log record for nested JSON payloads if certain preconditions are met:

  1. The log record does not have a severity number or severity text yet.
  2. The log record body is either a string (which contains the JSON payload) or a map.
  3. If the log record body is a string, it must contain a valid JSON object. After leading and trailing whitespace is removed, it must start with { and end with }.
  4. The JSON object contains a message field (see Message), or Dash0 can determine a log level from it (see Log Level), or both.

If none of these fields is found, Dash0 leaves the log record unchanged.

If Dash0 processed nested structured data within a log record, it will add a log record attribute named dash0.log.processor.type with the value json.

Other Fields

What happens to the remaining fields depends on whether Dash0 finds a message field:

  • With a message field: The log record body is replaced with the message. Every other top-level field is copied to a log record attribute with the same name. Fields whose names are OpenTelemetry resource semantic convention attributes (for example service.version or k8s.namespace.name) are set on the resource instead. This also applies to their underscore variants: a field named host_name becomes the resource attribute host.name. A nested JSON object becomes a single attribute with a map value.
  • Without a message field: The body keeps the full JSON payload, and the remaining fields are not copied to attributes.

In both cases, Dash0 still maps the log level, timestamp, trace context, and the other fields described on this page. Fields that Dash0 has already mapped (such as the level, timestamp, or trace ID field) are not copied again as attributes.

Example

Take this JSON log line:

json
{"time":"2026-11-27T10:15:30.123Z","level":"WARN","msg":"Payment retry scheduled","trace_id":"4bf92f3577b34da6a3ce929d0e0e4736","span_id":"00f067aa0ba902b7","service.version":"1.4.2","order":{"id":"A-1001","attempt":2}}

Dash0 turns it into a log record with:

Log record fieldValueSource
BodyPayment retry scheduledmsg
Severity number13 (Warn)level
Timestamp2026-11-27T10:15:30.123Ztime
Trace ID4bf92f3577b34da6a3ce929d0e0e4736trace_id
Span ID00f067aa0ba902b7span_id
Resource attribute service.version1.4.2service.version
Log record attribute orderMap with id and attemptorder
Log record attribute dash0.log.processor.typejsonAdded by Dash0

Message

The following keys are mapped to the log record body (first match wins):

  • @m
  • msg
  • MESSAGE
  • Message
  • message
  • log
  • output
  • logmessage

The value must be a string.

Log Level

The following keys are mapped to the log record severity number (first match wins):

  • log.level
  • LEVEL
  • Level
  • level
  • s
  • priority
  • @l
  • _logLevel

The value must be a string. It is matched case-insensitively against the values in Severity Mapping, so WARN and warn both map to 13 (Warn). Numeric levels are not mapped. If a value is not in the table, Dash0 tries the next key.

The log.level key also matches a nested object, as in {"log": {"level": "info"}}.

If no key matches, Dash0 recognizes the JSON log format of Kubernetes components . A log with a numeric ts, a string msg, a numeric verbosity v between 0 and 10, and no err maps to 9 (Info). A log with a numeric ts, a string msg, and a string err but no v maps to 17 (Error).

Severity Mapping

The severity in the previously listed fields is mapped to the log record severity number as follows:

Trace

ValueSeverity Number
finest1 (Trace)
t1 (Trace)
trace1 (Trace)
loglevel.trace1 (Trace)

Debug

ValueSeverity Number
v5 (Debug)
verbose5 (Debug)
d5 (Debug)
d15 (Debug)
d26 (Debug2)
d37 (Debug3)
d48 (Debug4)
d58 (Debug4)
dbg5 (Debug)
debug5 (Debug)
finer5 (Debug)
fine6 (Debug2)
config7 (Debug3)
loglevel.debug5 (Debug)

Info

ValueSeverity Number
i9 (Info)
inf9 (Info)
info9 (Info)
information9 (Info)
informational9 (Info)
loglevel.information9 (Info)
notice10 (Info2)

Warn

ValueSeverity Number
w13 (Warn)
wrn13 (Warn)
warn13 (Warn)
warning13 (Warn)
loglevel.warning13 (Warn)

Error

ValueSeverity Number
e17 (Error)
err17 (Error)
error17 (Error)
severe17 (Error)
loglevel.error17 (Error)
critical18 (Error2)
dpanic18 (Error2)
alert19 (Error3)
panic19 (Error3)

Fatal

ValueSeverity Number
f21 (Fatal)
fatal21 (Fatal)
emergency21 (Fatal)
loglevel.critical21 (Fatal)

Service Name

The following keys are mapped to the service.name attribute (first match wins):

  • service_name
  • serviceName
  • otelServiceName

Kubernetes Pod Name

If the JSON contains a kubernetes object with a string pod_name field, as in {"kubernetes": {"pod_name": "checkout-7d9f8b6c5-x2x4k"}}, its value is mapped to the k8s.pod.name attribute.

Event Name

The otel.event.name key is mapped to the log record event name. The value must be a string.

Timestamp

The following keys are mapped to the log record time (first match wins):

  • @timestamp
  • TIMESTAMP
  • Timestamp
  • timestamp
  • @t
  • time
  • ts
  • date_time
  • date

The following values are accepted:

  • RFC 3339 string: A string with a UTC offset, such as 2026-11-27T10:15:30Z or 2026-11-27T10:15:30.123+01:00. Fractional seconds are allowed.
  • Unix epoch: A number or a numeric string. Dash0 first reads the value as milliseconds. If that gives a date before 1971, Dash0 reads it as seconds instead, so both 1795774530123 and 1795774530.123 work.

A value in any other format is ignored, and Dash0 tries the next key. For example, a string without a UTC offset, such as 2026-11-27T10:15:30, is ignored. If no key has an accepted value, the log record keeps its original timestamp.

For MongoDB logs , Dash0 also reads an RFC 3339 string from t.$date, as in {"t": {"$date": "2026-11-27T10:15:30.123+00:00"}}.

Trace ID

The following keys are mapped to the Trace ID (first match wins):

  • trace_id
  • trace.id
  • traceId
  • TraceId
  • TraceID
  • @tr
  • otelTraceID

Note: Only hex-encoded strings with exactly 16 bytes (32 hex characters) are eligible as Trace ID.

Span ID

The following keys are mapped to the Span ID (first match wins):

  • span_id
  • span.id
  • spanId
  • SpanId
  • SpanID
  • @sp
  • otelSpanID

Note: Only hex-encoded strings with exactly 8 bytes (16 hex characters) are eligible as Span ID.

Trace Sampling

The following keys are used to set the trace flag SAMPLED (first match wins):

  • otelTraceSampled
  • sampled

The value must be a boolean, or a string that represents a boolean, such as "true" or "false".

Trace Context From Log Attributes

This mapping applies to every log record, whether its body is JSON or not.

If a log record has no trace ID or no span ID yet, Dash0 looks for a log record attribute whose name is one of the Trace ID or Span ID keys listed above. If the attribute holds a valid ID, Dash0 copies it into the log record's own trace ID or span ID field. The attribute itself is kept.

A span ID is only set when the log record has a trace ID, or gets one from its attributes.

If the JSON body (or the Java MDC) also contains a trace ID or span ID, the value from the JSON takes precedence.

journald (systemd)Release historyThis feature was introduced by Journald Log Support on December 18, 2024.

If a journal entry is detected (includes a key named __CURSOR), the following keys are mapped to their corresponding log record attribute according to the OpenTelemetry Semantic Conventions:

KeyOpenTelemetry Attribute
_HOSTNAMEhost.name
_MACHINE_IDhost.id
_PIDprocess.pid
_COMMprocess.executable.name
_EXEprocess.executable.path
_CMDprocess.command
_CMDLINEprocess.command_line
_UIDprocess.owner
_TRANSPORTlog.iostream
_SYSTEMD_CGROUPprocess.linux.cgroup

The _SOURCE_REALTIME_TIMESTAMP key is also mapped to the log record timestamp if it exists and contains an integer number of microseconds since the Unix epoch, as a string.

journald Severity Mapping

The priority in the PRIORITY field of a journal entry is mapped to log record severity number as follows:

PrioritySeverity NumberDescription
024 (Fatal4)Emergency: system is unusable
121 (Fatal)Alert: action must be taken immediately
218 (Error2)Critical: critical conditions
317 (Error)Error: error conditions
413 (Warn)Warning: warning conditions
510 (Info2)Notice: normal but significant condition
69 (Info)Informational: informational messages
75 (Debug)Debug: debug-level messages

pino

For pino , the following nested keys under the err key are mapped. This only happens when err.message, err.type, and err.stack are all present and are strings.

KeyOpenTelemetry Attribute
err.messageexception.message
err.typeexception.type
err.stackexception.stacktrace

See also: https://getpino.io/#/docs/api?id=errors 

Java (MDC)

The contents of the mdc key are lifted to the root level of log record attributes.

For example, mdc.loggerName would be available as an attribute with the key loggerName.

A trace ID, span ID, or sampled flag inside mdc is mapped like a top-level one (see Trace ID, Span ID, and Trace Sampling) and is not lifted to the attributes. If both mdc and the top level contain one, the top-level value wins.

See also:

Last updated: