In Fluent Bit's metrics_selector processor, the action attribute decides whether matching metrics are retained or rejected. Set action to include to keep only metrics matching metric_name; set it to exclude to remove matching metrics. The current implementation treats any value other than include as exclude, so use the supported values explicitly. section 9.2.4
Combine action with metric_name and, when useful, operation_type:
- Use include to reduce a broad metric stream to names matching the filter. section 9.2.4
- Use exclude to discard metrics matching the filter and retain the remainder. section 9.2.4
- Express metric_name as a literal name or a regular expression; a value beginning with a forward slash is inferred as a regular expression. section 9.2.4
- Choose prefix or substring with operation_type when literal matching should inspect the beginning or anywhere in the metric name. section 9.2.4
Keep node CPU metrics
Configure node_exporter_metrics with metrics_selector, action: include, and metric_name: /^node_cpu*/. Running Fluent Bit with this configuration emits node_cpu_seconds_total series while excluding the other metrics produced by the input. A prefix operation can replace the regular expression when the filter only needs to test the start of the name; this avoids the greater computational cost of regular-expression matching. section 9.2.4
Listing 9.4 Using processors to filter our metrics: processor-metrics.yaml
service:
log_level: info
http_server: on
flush: 1
pipeline:
inputs:
- name: node_exporter_metrics #1
tag: flb-metrics
scrape_interval: 10
processors:
metrics: #2
- name: metrics_selector #3
action: include #4
metric_name: /^node_cpu*/ #5
outputs:
- name: stdout
match: "*"
Inspect a complete metrics_selector configuration using node_exporter_metrics, include, and a node_cpu metric-name pattern. section 9.2.4
