liveBook · Manning

Multiline filter

As explained in Logs and Telemetry

A multiline filter is a Fluent Bit filter that combines related records from multiple events into a single multiline event.

A multiline filter combines related records from multiple events into one multiline event. It behaves like a parser filter, but uses multiline-prefixed settings to identify the content field and parser. section 6.6

Configure the filter around these operational choices:

  • Select a custom or predefined parser with multiline.parser and identify the field with multiline.key_content. section 6.6
  • Set buffer on when separate events for one record arrive in sequence with the same tag; verify ordering before enabling consolidation. section 6.6
  • Control oversized or unterminated records with emitter storage, emitter_mem_buf_limit, and flush_ms. section 6.6

Tail input with a custom multiline parser

A practical configuration tails multiline-json-small.txt, tags records multi-feed, applies multiline_Demo to the log field, enables buffering, and writes the result to stdout. Run it with fluent-bit -c fluentbit/multiline-parser-filter.conf. section 6.6

Figure 6.2 Each part of a multiline log (left) can correlate to a parser configuration (right). As long as the regex is valid at the right point, we will keep linking lines into a single event. In the figure, the rule named line_2 picks up five lines. As the line_2 rule is cyclical, we can continue consuming many lines into the same event if it isn’t expressed well.
figure

Inspect how stateful regex rules link lines and how a cyclical continuation rule can consume too many lines when expressed incorrectly. section 6.6

How Logs and Telemetry covers it

How deep it goes
Explains configuration, ordering risks, parser rules, buffering, storage, limits, and forced flushing.
Examples
Uses a tail input, custom regex parser, multi-feed tag, buffered filter, stdout output, and sample multiline JSON logs.
What it assumes
Assumes familiarity with Fluent Bit inputs, tags, filters, parsers, and configuration files.
What you can do after
Operate/configure Fluent Bit to consolidate ordered multiline records and limit memory or file-backed buffering.
How it connects
Connects multiline parsing with parser filters, input plugins, regex parsers, tags, buffering, and Kubernetes logs.

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.