Edge Delta Log Level Detector Filter
2 minute read
See the latest version here.
You can use a filter to identify logs based on the log severity level. These filters can be used in workflows to manipulate or route logs. The log filter can also be used to define a custom level tag as well as a fallback value if no level can be detected in the log.
Log Level Detection Example
The following configuration identifies logs that match the regex pattern WARN or ERROR. If no log level can be detected, the filter is configured with a fallback_value to assign the log the INFO level.
filters:
- name: warn_error_detection
type: log-level-detector
pattern: WARN|ERROR
fallback_value: INFO
The following configuration uses a capture group to detect the log level. Only a single unnamed capture group can be used. The filter assigns the detected log level with a new field name in a custom tag. The default is level but it has been changed to log_level in this example.
filters:
- name: capture_group_log_level_detection
type: log-level-detector
pattern: " level=(\\w+) "
field_name: log_level
Log Level Detection Parameter
Required Parameters
name (Required)
The name
parameter specifies the name for the filter. You refer to this name in other places, for example to refer to a specific filter in a workflow or processor. Names must be unique within the filters:
section. It is a YAML list element so it begins with a -
and a space followed by the string. A name is a required parameter for a filter
filters:
- name: <filter-name>
type: log-level-detector (Required)
The type
parameter in the filter context specifies the type of filter to apply. A type is a required parameter for a filter.
filters:
- name: <filter-name>
type: <filter-type>
pattern (Required)
Enter a regular expression pattern to define which strings to match on. This parameter is required.