github.com/observiq/carbon@v0.9.11-0.20200820160507-1b872e368a5e/docs/types/expression.md (about)

     1  # Expressions
     2  
     3  Expressions give the config flexibility by allowing dynamic business logic rules to be included in static configs.
     4  Most notably, expressions can be used to route messages and add new fields based on the contents of the log entry
     5  being processed.
     6  
     7  For reference documentation of the expression language, see [here](https://github.com/antonmedv/expr/blob/master/docs/Language-Definition.md).
     8  
     9  Available to the expressions are a few special variables:
    10  - `$record` contains the entry's record
    11  - `$labels` contains the entry's labels
    12  - `$resource` contains the entry's resource
    13  - `$timestamp` contains the entry's timestamp
    14  - `env()` is a function that allows you to read environment variables
    15  
    16  ## Examples
    17  
    18  ### Add a label from an environment variable
    19  
    20  ```yaml
    21  - type: metadata
    22    labels:
    23      stack: 'EXPR(env("STACK"))'
    24  ```