Cribl - Docs

Getting started with Cribl LogStream

Questions? We'd love to help you! Meet us in #cribl (sign up)

Changelog    Guides

Regex Extract

Description


The Regex Extract function extract fields with regex named groups. (In Splunk these will be index-time fields). Fields that start with __ (double underscore) are special fields in Cribl. They are ephemeral and can be used by any function downstream but will not be added to events and will not exit the pipeline.

Usage


Filter: Filter expression (JS) that selects data to be fed through the function. Defaults to empty - all events will be evaluated.

Description: Simple description about this function. Defaults to empty.

Final: If true, stops data from being fed to the downstream functions. Defaults to No.

Regex: Regex literal with named capturing groups, e.g. (?<foo>bar) or special _NAME_N and _VALUE_N capturing groups which extract both name and value of a field e.g., (?<_NAME_0>[^\s=]+)=(?<_VALUE_0>[^\s]+). Defaults to empty. See Examples below.

Source Field: Field where to perform regex field extraction. Defaults to _raw.

Advanced Settings:

  • Max Exec: The maximum number of times to apply the Regex to source field, used by _NAME_N and _VALUE_N capturing groups. Named capturing groups will always use a value of 1. Defaults to 100.

Examples


Assume a simple event that looks like this: metric1=23 metric2=42 dc=23 abc=xyz

  1. Extract only the metric1 field:
    Regex: metric1=(?<metric1>\d+)
    Result: metric1:"23"
  2. Extract all k=v pairs:
    Regex: (?<_NAME_0>[^\s]+)=(?<_VALUE_0>[^\s]+)
    Result: metric1:"23", metric2:"42", dc"23", abc:"xyz"

Regex Extract


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.