Skip to content

feat(fluentbit): fix anagine CloudWatch routing and add url=/report/ filter#58

Merged
esentuna merged 1 commit into
mainfrom
fluentbit-anagine-routing-fix
Jun 1, 2026
Merged

feat(fluentbit): fix anagine CloudWatch routing and add url=/report/ filter#58
esentuna merged 1 commit into
mainfrom
fluentbit-anagine-routing-fix

Conversation

@alan-walsh

Copy link
Copy Markdown
Contributor

Summary

Two updates to the FluentBit config in ardac1prd:

  1. Fix CloudWatch routing for anagine logs — all anagine records now reliably reach CloudWatch
  2. Add url=/report/ as a 4th AND filter for OpenSearch-bound records

Problem

The previous rewrite_tag used Keep true, which re-emits the original kube.* record back to the beginning of the filter chain. This can cause unpredictable re-processing behaviour and was the likely reason anagine records were not consistently appearing in CloudWatch.

Changes

Two-stage explicit routing (filters)

Replaced the single rewrite_tag (Keep true) with two stages:

Stage From → To Keep Purpose
1 (anagine_all_reemit) kube.*anagine.all false Cleanly moves all anagine records out of kube.*
2 (anagine_filtered_reemit) anagine.allanagine.filtered true Forks a copy for grep filtering; preserves anagine.all for CloudWatch

New CloudWatch output (outputs)

Added a second cloudwatch_logs output block matching anagine.all so all anagine records are captured in CloudWatch regardless of whether they pass the OpenSearch filters.

Updated grep filters (filters)

Updated the three existing grep filters from Match anagine.rawMatch anagine.filtered.

New grep filter (filters)

Added a 4th AND condition on anagine.filtered:

Regex   log url=/report/

Resulting pipeline

Tag Destination
kube.* CloudWatch — all non-anagine container logs
anagine.all CloudWatch — all anagine logs (unfiltered)
anagine.filtered OpenSearch — anagine logs matching: INFO level + authenticated user + method=POST + url=/report/

…filter

- Replace single rewrite_tag (Keep true) with two-stage explicit routing
  to avoid re-emission loop ambiguity:
  - Stage 1: kube.* (anagine namespace) -> anagine.all  (Keep false)
  - Stage 2: anagine.all -> anagine.filtered  (Keep true)
- Add dedicated CloudWatch output matching anagine.all so ALL anagine
  records are captured in CloudWatch (previously only kube.* records
  were matched, which could be lost when Keep true re-emitted them)
- Update the three existing grep filters to match anagine.filtered
  instead of the old anagine.raw tag
- Add 4th grep filter: url=/report/ on anagine.filtered (AND condition)
- Update OpenSearch output to match anagine.filtered

Pipeline flow:
  kube.*         -> CloudWatch (all non-anagine logs)
  anagine.all    -> CloudWatch (all anagine logs, unfiltered)
  anagine.filtered -> OpenSearch (INFO + auth user + POST + url=/report/)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 1, 2026 16:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the FluentBit pipeline in ardac1prd to make CloudWatch routing for the ardac-anagine namespace deterministic and to tighten the OpenSearch filter set. Replaces the single Keep true rewrite_tag (which re-injected kube.* records and likely caused inconsistent CloudWatch delivery) with a two-stage tag rewrite, adds a dedicated CloudWatch output for the unfiltered anagine stream, and narrows the OpenSearch filter to url=/report/.

Changes:

  • Split anagine routing into two rewrite_tag stages: kube.*anagine.all (Keep false) and anagine.allanagine.filtered (Keep true).
  • Add a second cloudwatch_logs output matching anagine.all and re-target existing grep filters and the OpenSearch output from anagine.raw to anagine.filtered.
  • Add a 4th grep filter on anagine.filtered requiring url=/report/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@esentuna esentuna merged commit 7900f77 into main Jun 1, 2026
2 checks passed
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.

3 participants