Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 835 Bytes

expression.md

File metadata and controls

24 lines (18 loc) · 835 Bytes

Expressions

Expressions give the config flexibility by allowing dynamic business logic rules to be included in static configs. Most notably, expressions can be used to route messages and add new fields based on the contents of the log entry being processed.

For reference documentation of the expression language, see here.

Available to the expressions are a few special variables:

  • $record contains the entry's record
  • $labels contains the entry's labels
  • $resource contains the entry's resource
  • $timestamp contains the entry's timestamp
  • env() is a function that allows you to read environment variables

Examples

Add a label from an environment variable

- type: metadata
  labels:
    stack: 'EXPR(env("STACK"))'