liveBook · Manning

Key_exists condition

As explained in Logs and Telemetry

key_exists is an expect-filter check that requires a named key to be present in the event record.

key_exists checks whether a named key is present in an event record. In a modify filter, it acts as a Boolean condition: the filter performs its configured operation only when the key exists. section 7.3

The same check is available in the expect filter for validating event structure. Expect treats events as effectively immutable and can warn, return the failing key, or terminate execution when validation fails. section 7.3.5

Use key_exists when you need to:

Protecting ingestion from incomplete records

After a malformed JSON record prevents complete ingestion, use a conditional modify operation to act only when a required key exists, or use expect to flag records whose structure is incomplete. In production, give the failure result_key a unique name and preferably an error code so the issue can be traced. section 6.8.2 section 7.3.5

How Logs and Telemetry covers it

How deep it goes
Defines Boolean existence checks and validation actions, but does not provide a complete key_exists configuration example.
Examples
Uses malformed JSON, incomplete ingestion, conditional modification, and changed application log structure as operational examples.
What it assumes
Assumes familiarity with event records and Fluent Bit filters while distinguishing key presence from null values and literal value checks.
What you can do after
Diagnose with expect or conditionally transform events with modify when required keys are present or absent.
How it connects
Connects modify filters, expect filters, event parsing, event validation, and logging configuration.

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.