liveBook · Manning

Record accessor

As explained in Logs and Telemetry

A record accessor is Fluent Bit expression syntax for selecting values from event records and metadata when constructing or evaluating configuration values.

A record accessor is Fluent Bit expression syntax for selecting event-record data and reserved metadata while filters evaluate conditions or construct configuration values. Prefix references with $, then traverse JSON payloads through quoted field names or indexes in square brackets. section 7.4.1

Use record accessors to:

  • Read reserved values such as the current event tag with $tag. section 7.4.1
  • Read root-level JSON fields such as $remote_ip. section 7.4.1
  • Traverse nested fields, such as $request['verb'], using JSONPath-style bracket notation. section 7.4.1
  • Build rewritten tags by combining literal text with string-valued record references. section 7.4.2

Constructing a routed tag

For a record whose request verb is GET, the rewrite_tag rule can construct Apps.GET.onSrv.Watts with $TAG.$request['verb'].onSrv.$Hostname. A true final Boolean keeps the original event and emits a clone; false changes the tag instead. section 7.4.2

{
  "time": "12/May/2023:08:05:52 +0000",
  "remote_ip": "10.4.72.163",
  "remote_user": "-",
  "request": {
    "verb": "GET",
    "path": " /downloads/product_2",
    "protocol": "HTTP",
    "version": "1.1"
  },
  "response": 304,
  "bytes": 0,
  "referrer": "-",
  "agent": "Mozilla/5.0  (0.9.7.9)"
}

Inspect the JSON event structure used for root-level and nested accessor examples, including remote_ip, request.verb, response, and other fields. section 7.4.1

Missing fields return no value: the operation takes no action, leaves the record unchanged, and lets later pipeline steps continue. Support exists only in a subset of plugins, and rewrite-tag construction requires string-valued references. section 7.4.1 section 7.4.2

How Logs and Telemetry covers it

How deep it goes
Explains prefixes, nested traversal, string constraints, missing-field behavior, and plugin scope without detailing accessor internals.
Examples
Demonstrates $remote_ip, $request['verb'], and a rewrite expression producing Apps.GET.onSrv.Watts from structured event data.
What it assumes
Assumes familiarity with Fluent Bit filters and JSON records while teaching accessor notation and nested-field traversal directly.
What you can do after
Apply record accessors in supported Fluent Bit filters to select fields, test rules, and construct string-valued rewritten tags.
How it connects
Connects JSON payloads, JSONPath-style traversal, filters, regular expressions, event tags, and tag rewriting.

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.