liveBook · Manning

JSONL

As explained in Logs and Telemetry

JSON Lines is a serialization format that represents each JSON value as a separate line.

JSONL, or JSON Lines, serializes JSON so that each value occupies a separate line. In Fluent Bit, the stdout output plugin selects this behavior with format json_lines, making console output easier to inspect as a sequence of individual log events. section 5.4 section 2.1.3

Use JSONL output when record boundaries matter in a stream:

  • Set format json_lines on an stdout output to emit each matching event on its own line. section 5.4
  • Route events to that output with match; * acts as a wildcard for tags. section 5.4
  • Add a received timestamp with json_date_key, then choose json_date_format such as iso8601, epoch, or epoch_ms. section 5.4
  • Choose json_lines rather than json_stream when each record must be line-delimited; both produce syntactically correct JSON output. section 2.1.3

Console output with ISO 8601 timestamps

Configure an HTTP input and route all tags to stdout. Setting format json_lines keeps each received log event on one line; json_date_key received-date and json_date_format iso8601 add a received-date field in ISO 8601 form. section 5.4

Listing 5.4 Formatting output: std-output.conf
[SERVICE]
  flush 1
  log_level error     #1

[INPUT]
  name http    
  listen 0.0.0.0
  port 9881
  tag http-in

[OUTPUT]
  match *         #2
  name stdout         #3
  format json_lines          #4
  json_date_key received-date     #5
  json_date_format iso8601        #6

This configuration shows the operational core: stdout, wildcard matching, JSONL formatting, and an ISO 8601 received-date field. section 5.4

How Logs and Telemetry covers it

How deep it goes
Explains output configuration, record separation, tag matching, and timestamp formatting, but not JSON parsing or downstream consumption.
Examples
Uses dummy inputs with two stdout outputs and an HTTP input configuration that prints records to the console.
What you can do after
Operate/configure it by setting Fluent Bit stdout format=json_lines and optional ISO 8601 received-date fields.
How it connects
Connects JSONL to Fluent Bit stdout output, tags, match routing, JSON timestamps, and ISO 8601.

Also explained in

Compare how 3 books explain JSONL →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Logs and Telemetry. The section links point to the parts of the book it draws on.