Skip to content
Novus Examples
jsonl7.2 KB

OTLP Logs — NDJSON Stream, One Record per Line (jsonl)

The same five OTLP log records reframed as one self-contained export per line, with the resource attributes repeated on every line. The trade a line-oriented sink makes: each line stands alone, at the cost of repeating the resource block five times.

Preview — first 6 linesjsonl
{"resourceLogs":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"checkout-api"}},{"key":"service.namespace","value":{"stringValue":"shop"}},{"key":"service.version","value":{"stringValue":"1.14.2"}},{"key":"service.instance.id","value":{"stringValue":"checkout-api-7d9f4c-2xk"}},{"key":"deployment.environment.name","value":{"stringValue":"staging"}},{"key":"host.name","value":{"stringValue":"node-a1"}},{"key":"host.ip","value":{"stringValue":"192.0.2.11"}},{"key":"cloud.region","value":{"stringValue":"eu-west-1"}},{"key":"k8s.namespace.name","value":{"stringValue":"shop"}},{"key":"k8s.pod.name","value":{"stringValue":"checkout-api-7d9f4c-2xk"}},{"key":"process.pid","value":{"intValue":"4211"}},{"key":"telemetry.sdk.name","value":{"stringValue":"opentelemetry"}},{"key":"telemetry.sdk.language","value":{"stringValue":"java"}},{"key":"telemetry.sdk.version","value":{"stringValue":"1.34.0"}}]},"scopeLogs":[{"scope":{"name":"com.example.shop.checkout","version":"1.14.2"},"logRecords":[{"timeUnixNano":"1773738872850000000","observedTimeUnixNano":"1773738872851200000","severityNumber":9,"severityText":"INFO","body":{"stringValue":"checkout request received"},"attributes":[{"key":"http.request.method","value":{"stringValue":"POST"}},{"key":"http.route","value":{"stringValue":"/api/checkout"}}],"traceId":"4bf92f3577b34da6a3ce929d0e0e4736","spanId":"00f067aa0ba902b7","flags":1}]}]}]}
{"resourceLogs":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"checkout-api"}},{"key":"service.namespace","value":{"stringValue":"shop"}},{"key":"service.version","value":{"stringValue":"1.14.2"}},{"key":"service.instance.id","value":{"stringValue":"checkout-api-7d9f4c-2xk"}},{"key":"deployment.environment.name","value":{"stringValue":"staging"}},{"key":"host.name","value":{"stringValue":"node-a1"}},{"key":"host.ip","value":{"stringValue":"192.0.2.11"}},{"key":"cloud.region","value":{"stringValue":"eu-west-1"}},{"key":"k8s.namespace.name","value":{"stringValue":"shop"}},{"key":"k8s.pod.name","value":{"stringValue":"checkout-api-7d9f4c-2xk"}},{"key":"process.pid","value":{"intValue":"4211"}},{"key":"telemetry.sdk.name","value":{"stringValue":"opentelemetry"}},{"key":"telemetry.sdk.language","value":{"stringValue":"java"}},{"key":"telemetry.sdk.version","value":{"stringValue":"1.34.0"}}]},"scopeLogs":[{"scope":{"name":"com.example.shop.checkout","version":"1.14.2"},"logRecords":[{"timeUnixNano":"1773738872856200000","observedTimeUnixNano":"1773738872857400000","severityNumber":5,"severityText":"DEBUG","body":{"stringValue":"cart priced"},"attributes":[{"key":"shop.cart.items","value":{"intValue":"3"}},{"key":"shop.order.total_minor","value":{"intValue":"8497"}}],"traceId":"4bf92f3577b34da6a3ce929d0e0e4736","spanId":"2b3c4d5e6f708192","flags":1}]}]}]}
{"resourceLogs":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"checkout-api"}},{"key":"service.namespace","value":{"stringValue":"shop"}},{"key":"service.version","value":{"stringValue":"1.14.2"}},{"key":"service.instance.id","value":{"stringValue":"checkout-api-7d9f4c-2xk"}},{"key":"deployment.environment.name","value":{"stringValue":"staging"}},{"key":"host.name","value":{"stringValue":"node-a1"}},{"key":"host.ip","value":{"stringValue":"192.0.2.11"}},{"key":"cloud.region","value":{"stringValue":"eu-west-1"}},{"key":"k8s.namespace.name","value":{"stringValue":"shop"}},{"key":"k8s.pod.name","value":{"stringValue":"checkout-api-7d9f4c-2xk"}},{"key":"process.pid","value":{"intValue":"4211"}},{"key":"telemetry.sdk.name","value":{"stringValue":"opentelemetry"}},{"key":"telemetry.sdk.language","value":{"stringValue":"java"}},{"key":"telemetry.sdk.version","value":{"stringValue":"1.34.0"}}]},"scopeLogs":[{"scope":{"name":"com.example.shop.checkout","version":"1.14.2"},"logRecords":[{"timeUnixNano":"1773738872919000000","observedTimeUnixNano":"1773738872920200000","severityNumber":13,"severityText":"WARN","body":{"stringValue":"downstream call slower than budget"},"attributes":[{"key":"budget.ms","value":{"intValue":"50"}},{"key":"observed.ms","value":{"doubleValue":71.2}}],"traceId":"4bf92f3577b34da6a3ce929d0e0e4736","spanId":"8192a3b4c5d6e7f8","flags":1}]}]}]}
{"resourceLogs":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"payments-api"}},{"key":"service.namespace","value":{"stringValue":"shop"}},{"key":"service.version","value":{"stringValue":"3.1.4"}},{"key":"service.instance.id","value":{"stringValue":"payments-api-31ef60-7wz"}},{"key":"deployment.environment.name","value":{"stringValue":"staging"}},{"key":"host.name","value":{"stringValue":"node-b2"}},{"key":"host.ip","value":{"stringValue":"192.0.2.22"}},{"key":"cloud.region","value":{"stringValue":"eu-west-1"}},{"key":"k8s.namespace.name","value":{"stringValue":"shop"}},{"key":"k8s.pod.name","value":{"stringValue":"payments-api-31ef60-7wz"}},{"key":"process.pid","value":{"intValue":"7452"}},{"key":"telemetry.sdk.name","value":{"stringValue":"opentelemetry"}},{"key":"telemetry.sdk.language","value":{"stringValue":"python"}},{"key":"telemetry.sdk.version","value":{"stringValue":"1.34.0"}}]},"scopeLogs":[{"scope":{"name":"example.shop.payments","version":"3.1.4"},"logRecords":[{"timeUnixNano":"1773738874921500000","observedTimeUnixNano":"1773738874922700000","severityNumber":17,"severityText":"ERROR","body":{"stringValue":"Traceback (most recent call last):\n  File \"/srv/payments/handlers/authorize.py\", line 118, in authorize\n    charge = psp.create_charge(token, amount_minor, currency)\n  File \"/srv/payments/psp/client.py\", line 141, in _post\n    raise UpstreamTimeout(f\"{path} exceeded {timeout}s\")\nshop.payments.errors.UpstreamTimeout: /v1/charges exceeded 2.0s"},"attributes":[{"key":"exception.type","value":{"stringValue":"shop.payments.errors.UpstreamTimeout"}},{"key":"exception.escaped","value":{"boolValue":true}},{"key":"log.record.original","value":{"stringValue":"multi-line body"}}],"traceId":"4bf92f3577b34da6a3ce929d0e0e4736","spanId":"a3b4c5d6e7f8091a","flags":1}]}]}]}
{"resourceLogs":[{"resource":{"attributes":[{"key":"service.name","value":{"stringValue":"payments-api"}},{"key":"service.namespace","value":{"stringValue":"shop"}},{"key":"service.version","value":{"stringValue":"3.1.4"}},{"key":"service.instance.id","value":{"stringValue":"payments-api-31ef60-7wz"}},{"key":"deployment.environment.name","value":{"stringValue":"staging"}},{"key":"host.name","value":{"stringValue":"node-b2"}},{"key":"host.ip","value":{"stringValue":"192.0.2.22"}},{"key":"cloud.region","value":{"stringValue":"eu-west-1"}},{"key":"k8s.namespace.name","value":{"stringValue":"shop"}},{"key":"k8s.pod.name","value":{"stringValue":"payments-api-31ef60-7wz"}},{"key":"process.pid","value":{"intValue":"7452"}},{"key":"telemetry.sdk.name","value":{"stringValue":"opentelemetry"}},{"key":"telemetry.sdk.language","value":{"stringValue":"python"}},{"key":"telemetry.sdk.version","value":{"stringValue":"1.34.0"}}]},"scopeLogs":[{"scope":{"name":"example.shop.payments","version":"3.1.4"},"logRecords":[{"timeUnixNano":"1773738874990000000","observedTimeUnixNano":"1773738874991200000","severityNumber":21,"severityText":"FATAL","body":{"stringValue":"circuit breaker opened for psp.example.net"},"attributes":[{"key":"breaker.state","value":{"stringValue":"open"}},{"key":"breaker.failures","value":{"intValue":"12"}}]}]}]}]}

Specifications

Lines
5
Records Per Line
1
Resource Repeated Per Line
true
Framing
one ExportLogsServiceRequest per line
Same Records As
otlp-logs-export-document

Testing contract

Expected to pass
Scenario
Process the stream line by line and compare the result to the batched document.
Expected result
Five independently parseable lines yield the same five log records as the batched export, with resource attributes repeated rather than shared.

What is a .jsonl file?

JSONL (JSON Lines) is a text format where each line is a complete, independent JSON value, allowing records to be streamed and appended without parsing the whole file. It is not itself a JSON array and each line must stand alone. It is common in logging, machine learning datasets, and data pipelines.

How to use this file

Use an example JSONL to test line-by-line streaming parsers, append-and-resume ingestion, and batch pipelines that process one record per line.

How to use this file for testing

“OTLP Logs — NDJSON Stream, One Record per Line (jsonl)” is a deterministic Novus Examples fixture for Observability, JSON parsing, Data engineering. Structured and plain-text telemetry with known timestamps, levels, request identifiers, and error states for testing log ingestion, correlation, dashboards, and alert pipelines.

Documented properties for this file: JSONL · 7,405 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Telemetry fixtures use fixed trace IDs, span IDs, and timestamps so ingestion is reproducible run to run. Point your collector, parser, or query layer at the file and assert the documented span tree, metric families, or severity mix; service and host names are invented.

Code examples

import json

with open("otlp-logs-stream.jsonl") as f:
    rows = [json.loads(line) for line in f]
print(len(rows), rows[0])

Generated by generation/observability.py. Free for any use, no attribution required — license.