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

[aws-for-fluent-bit] logRetentionPeriod parameter is not working for existing logGroups #1029

Open
shubhindia opened this issue Nov 29, 2023 · 2 comments · May be fixed by #1168
Open

[aws-for-fluent-bit] logRetentionPeriod parameter is not working for existing logGroups #1029

shubhindia opened this issue Nov 29, 2023 · 2 comments · May be fixed by #1168
Labels
bug Something isn't working

Comments

@shubhindia
Copy link

shubhindia commented Nov 29, 2023

I have deployed aws-for-fluent-bit with logRetention set to 90 days using argo.
Below is the argo application yaml

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: aws-for-fluent-bit
  namespace: argocd
spec:
  destination:
    namespace: fluent-bit
    server: https://kubernetes.default.svc
  project: admin
  source:
    chart: aws-for-fluent-bit
    helm:
      values: |
        cloudWatchLogs:
          region: us-west-2
          logRetentionDays: 90
        serviceAccount:
          create: true
          name: aws-for-fluent-bit
          annotations:
            eks.amazonaws.com/role-arn: arn:aws:iam::<redacted>:role/role-for-fluent_bit-us-west-2
    repoURL: https://aws.github.io/eks-charts
    targetRevision: 0.1.28
  syncPolicy:
    automated:
      selfHeal: true
    syncOptions:
    - Replace=true
    - CreateNamespace=true

This deploys fine but all the older logGroups still have never as retention period .
Below is the fluent-bit.conf.

[SERVICE]
    HTTP_Server  On
    HTTP_Listen  0.0.0.0
    HTTP_PORT    2020
    Health_Check On
    HC_Errors_Count 5
    HC_Retry_Failure_Count 5
    HC_Period 5

    Parsers_File /fluent-bit/parsers/parsers.conf
[INPUT]
    Name              tail
    Tag               kube.*
    Path              /var/log/containers/*.log
    DB                /var/log/flb_kube.db
    Parser            docker
    Docker_Mode       On
    Mem_Buf_Limit     5MB
    Skip_Long_Lines   On
    Refresh_Interval  10
[FILTER]
    Name                kubernetes
    Match               kube.*
    Kube_URL            https://kubernetes.default.svc.cluster.local:443
    Merge_Log           On
    Merge_Log_Key       data
    Keep_Log            On
    K8S-Logging.Parser  On
    K8S-Logging.Exclude On
    Buffer_Size         32k
[OUTPUT]
    Name                  cloudwatch_logs
    Match                 *
    region                us-west-2
    log_group_name        /aws/eks/fluentbit-cloudwatch/logs
    log_group_template    /aws/eks/fluentbit-cloudwatch/workload/$kubernetes['namespace_name']
    log_stream_prefix     fluentbit-
    log_stream_template   $kubernetes['pod_name'].$kubernetes['container_name']
    auto_create_group     true
    log_retention_days    90

The policy attached to this role has required permissions as well

      {
        "Effect" : "Allow",
        "Action" : [
          "cloudwatch:PutMetricData",
          "ec2:DescribeVolumes",
          "ec2:DescribeTags",
          "logs:PutLogEvents",
          "logs:DescribeLogStreams",
          "logs:DescribeLogGroups",
          "logs:CreateLogStream",
          "logs:CreateLogGroup",
          "logs:PutRetentionPolicy"
        ],
        "Resource" : "*"
      }
@shubhindia shubhindia added the bug Something isn't working label Nov 29, 2023
@shubhindia shubhindia changed the title [aws-for-fluent-bit] logRetentionPeriod is not working [aws-for-fluent-bit] logRetentionPeriod parameter is not working Nov 29, 2023
@shubhindia shubhindia changed the title [aws-for-fluent-bit] logRetentionPeriod parameter is not working [aws-for-fluent-bit] logRetentionPeriod parameter is not working for existing logGroups Nov 29, 2023
@lteixeira-dock
Copy link

I have the same issue.

I deployed a FluentBit setting the retention to 14 days, but When I change the same parameter to 7 days. The fluentBit doesn't update the retention policy in CW LogGroups existing

  • EKS Cluster: 1.26
  • Image: amazon/aws-for-fluent-bit:2.32.0

@sav-work
Copy link

I have the same issue

log_retention_days 90

Applies only when creating a new LogGroup, if LogGroup already exists new parameter does not update it
I think it should be added to the documentation

Thank you.

  • EKS Cluster: 1.28
  • aws-for-fluent-bit:2.31.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants