Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 2.22 KB

router.md

File metadata and controls

59 lines (44 loc) · 2.22 KB

router operator

The router operator allows logs to be routed dynamically based on their content.

The operator is configured with a list of routes, where each route has an associated expression. An entry sent to the router operator is forwarded to the first route in the list whose associated expression returns true.

An entry that does not match any of the routes is dropped and not processed further.

Configuration Fields

Field Default Description
id router A unique identifier for the operator
routes required A list of routes. See below for details
default The operator(s) that will receive any entries not matched by any of the routes

Route configuration

Field Default Description
output required The connected operator(s) that will receive all outbound entries for this route
expr required An expression that returns a boolean. The record of the routed entry is available as $
labels {} A map of key: value labels to add to an entry that matches the route

Examples

Forward entries to different parsers based on content

- type: router
  routes:
    - output: my_json_parser
      expr: '$.format == "json"'
    - output: my_syslog_parser
      expr: '$.format == "syslog"'

Drop entries based on content

- type: router
  routes:
    - output: my_output
      expr: '$.message matches "^LOG: .* END$"'

Route with a default

- type: router
  routes:
    - output: my_json_parser
      expr: '$.format == "json"'
    - output: catchall
      expr: 'true'