- 0 minutes to read

Formula - ContextKey

Use the contextKey Formula function with a regular expression to extract matching Key-names from the Log Event context (Key-Value collection).

Quick example

Let's get you started with the following example (Get all Keys matching the provided regular expression)

Input Expression Result
Order#123  
Order#456  
Order#789  
City=Karlstad  
...
contextKey(regex('Order#.*'))
Order#123
Order#456
Order#789

Text Data Context Unique values

Features

  • Extracts all Key names from the Key-Value collection (Context)

How to use

To configure the Formula plugin with the contextKey function:

  1. Select Formula as the expression type plugin.
  2. Write down the expression to use in the 'Expression' text area with the named Key to extract contextKey(regex('Order#.*'))
  3. The Context Key names are displayed in the Message Context tab
  4. The result is displayed

Extract context keys

Syntax

The contextKey function has the following syntax:

contextKey(regex('Expression'))

Next Step

How to Add or manage Search Fields
How to Add or manage Log Views

Expression Type Plugins are used in Search Fields
What are Search Fields?
What are Search Field Expressions?
What are Message Types?
What are Log Views?