Skip to content

feat(fluentbit): add flush interval options to the log_to_metrics filter - #2084

Open
cvas22 wants to merge 2 commits into
fluent:masterfrom
cvas22:feat/1459-log-to-metrics-flush-interval
Open

cvas22 wants to merge 2 commits into
fluent:masterfrom
cvas22:feat/1459-log-to-metrics-flush-interval

Conversation

@cvas22

@cvas22 cvas22 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds the flushIntervalSec and flushIntervalNsec options to the Fluent Bit logToMetrics filter (ClusterFilter and Filter). They're rendered as Fluent Bit's Flush_Interval_Sec and Flush_Interval_Nsec.

Without them, the filter emits metrics right after every matching record. #1459 reports this produces duplicate samples with the same timestamp and different values in Prometheus. With an interval set, metrics are emitted once per interval, which also lowers resource use under load.

Both fields are optional and validated as non-negative (flushIntervalNsec up to 999999999). When they aren't set nothing is rendered, so existing configs are unchanged.

filters:
  - logToMetrics:
      tag: metrics
      metricMode: counter
      metricName: count_all
      flushIntervalSec: 30

Which issue(s) this PR fixes:

Fixes #1459

Does this PR introduced a user-facing change?

The Fluent Bit logToMetrics filter supports flushIntervalSec and flushIntervalNsec.

Notes

I ran the generators (make generate manifests docs-update, in WSL with controller-gen v0.18.0) rather than editing generated files by hand. They updated the filter deepcopy, the filters CRDs (config, both charts, manifests/setup/setup.yaml) and docs/plugins/fluentbit/filter/log_to_metrics.md.

Tested locally: go test ./apis/... passes, including the new TestFilter_LogToMetrics_* cases (with and without the interval), and make lint reports 0 issues.

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
…etrics flush interval

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: add flush_interval_sec

1 participant