liveBook · Manning

Action attribute

As explained in Logs and Telemetry

An action attribute is a metrics-selector configuration field that determines whether matching metrics are included or excluded.

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

How Logs and Telemetry covers it

How deep it goes
Defines inclusion, exclusion, literal, prefix, substring, and regular-expression matching, but does not detail processor internals.
Examples
Demonstrates retaining node_cpu metrics from node_exporter_metrics and inspecting the resulting node_cpu_seconds_total series.
What it assumes
Assumes familiarity with Fluent Bit pipelines, processors, metric names, and basic literal or regular-expression matching.
What you can do after
Configure metric selection with include or exclude and choose an appropriate name-matching strategy.
How it connects
Connects metrics_selector with metric names, regular expressions, operation types, and node_exporter_metrics.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Logs and Telemetry. The section links point to the parts of the book it draws on.