aws / amazon-cloudwatch-logs-for-fluent-bit

A Fluent Bit output plugin for CloudWatch Logs
Apache License 2.0
170 stars 49 forks source link

new_log_group_tags parameter is not accepting variables #341

Open OmarCherdal1997 opened 1 year ago

OmarCherdal1997 commented 1 year ago

Hello,

Please i am facing an issue tagging my newly created AWS cloudwatch log groups by fluentbit

This is my current config

  fluent-bit.conf: |
    [SERVICE]
        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
    [FILTER]
        Name                nest
        Match               kube.*
        Operation           lift
        Nested_under        kubernetes
    [OUTPUT]
        Name                  cloudwatch
        Match                 **
        region                eu-west-1
        log_group_name        /aws/eks/$(namespace_name)
        log_stream_name       $(pod_name)
        log_retention_days    90
        auto_create_group     true
        new_log_group_tags    source=fluentbit,name=$namespace_name

but itthrows this error time="2023-06-24T16:42:49Z" level=error msg="InvalidParameterException: 1 validation error detected: Value '{cluster=cluster, name=$namespace_name, source=fluentbit}' at 'tags' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 256, Member must have length greater than or equal to 0, Member must satisfy regular expression pattern: ^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$]"

does someone has any idea how to pass the namespace variable to my cloudwatch group tags list ?