Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log_retention_days Parameter Not Applied to CloudWatch Logs Due to Inaccessibility of Record Data #9854

Open
trojaond opened this issue Jan 20, 2025 · 0 comments

Comments

@trojaond
Copy link

Bug Report

Describe the bug
The log_retention_days parameter is ignored because it cannot access record data via record_accessor. In contrast, log_stream_template and log_group_template can. Consequently, when a new log group is created, the retention setting defaults to "Never expire."

eg.: record:

{
  "log_retention": 7,
  "group_name": "/kubernetes/addons/fluentbit-test",
  "stream_name": "nginx"
}

fluentbit output configuration:

[OUTPUT]
    Name cloudwatch_logs
    Match kube.*
    log_group_name  fallback-group_name
    log_stream_prefix fallback-stream
    log_group_template $group_name.  ✅
    log_stream_template $stream_name   ✅
    auto_create_group true
    log_retention_days $log_retention ❌ (this does not work)

Image

Although Fluent Bit successfully pushes logs to CloudWatch, it sets their retention to "Never expire," which can be problematic.

To Reproduce

  • Create fluent bit configuration
  • Configure cloudwatch_log output to set log_retention_days to value of record

Expected behavior
The log retention settings defined in Fluent Bit are accurately propagated to CloudWatch. This means that the specified retention period should be applied automatically, ensuring logs are kept only for the intended duration.

Your Environment

  • Version used: v3.2.4
  • Configuration: EKS + Fluentbit + Cloudwatch

Additional context
This feature is particularly useful because it allows you to configure the retention period based on specific Kubernetes namespaces, deployments, and more. Moreover, the legacy Go CloudWatch plugin offers this capability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant