Skip to content

aws: add integrations for CloudWatch Explore related feature #10207

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

Open
wants to merge 6 commits into
base: 3.2
Choose a base branch
from

Conversation

zhihonl
Copy link
Contributor

@zhihonl zhihonl commented Apr 11, 2025

Note

There is currently a bug on 4.0 branch that causes crashes on start-up therefore could not test the change there. Creating this initial PR to 3.2 version for now until the issue is addressed: #10192

CloudWatch introduced a new feature called Explored Related which is a UI component that helps user navigate between their telemetry(metrics,logs) and AWS resources. This is done by including a new field in PutLogEvents API which is called Entity. More documentation about this new field can be found here: https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_Entity.html

Since FluentBit has a CloudWatch output plugin that emits logs to CloudWatch Logs, this PR adds changes that scrapes information necessary for populating the entity field.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Screenshot of how UI interacts with the changes made in this PR
    Screenshot 2025-04-11 at 4 01 56 PM

  • Example configuration file for the change

application-log.conf: |
          [INPUT]
            Name                tail
            Tag                 application.*
            Exclude_Path        /var/log/containers/cloudwatch-agent*, /var/log/containers/fluent-bit*, /var/log/containers/aws-node*, /var/log/containers/kube-proxy*
            Path                /var/log/containers/*.log
            multiline.parser    docker, cri
            DB                  /var/fluent-bit/state/flb_container.db
            Mem_Buf_Limit       50MB
            Skip_Long_Lines     On
            Refresh_Interval    10
            Rotate_Wait         30
            storage.type        filesystem
            Read_from_Head      ${READ_FROM_HEAD}
          
          [INPUT]
            Name                tail
            Tag                 application.*
            Path                /var/log/containers/fluent-bit*
            multiline.parser    docker, cri
            DB                  /var/fluent-bit/state/flb_log.db
            Mem_Buf_Limit       5MB
            Skip_Long_Lines     On
            Refresh_Interval    10
            Read_from_Head      ${READ_FROM_HEAD}
          
          [INPUT]
            Name                tail
            Tag                 application.*
            Path                /var/log/containers/cloudwatch-agent*
            multiline.parser    docker, cri
            DB                  /var/fluent-bit/state/flb_cwagent.db
            Mem_Buf_Limit       5MB
            Skip_Long_Lines     On
            Refresh_Interval    10
            Read_from_Head      ${READ_FROM_HEAD}
          
          [FILTER]
            Name                aws
            Match               application.*
          
          [FILTER]
            Name                kubernetes
            Match               application.*
            Kube_URL            https://kubernetes.default.svc:443
            Kube_Tag_Prefix     application.var.log.containers.
            Merge_Log           On
            Merge_Log_Key       log_processed
            K8S-Logging.Parser  On
            K8S-Logging.Exclude Off
            Labels              Off
            Annotations         Off
            Use_Kubelet         On
            Kubelet_Port        10250
            Buffer_Size         0
            Use_Pod_Association On
          
          [OUTPUT]
            Name                cloudwatch_logs
            Match               application.*
            region              ${AWS_REGION}
            log_group_name      /aws/containerinsights/${CLUSTER_NAME}/application
            log_stream_prefix   ${HOST_NAME}-
            auto_create_group   true
            extra_user_agent    container-insights
            add_entity          true
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found
SUCCESS: All unit tests have passed.
==23696==
==23696== HEAP SUMMARY:
==23696==     in use at exit: 0 bytes in 0 blocks
==23696==   total heap usage: 8,123 allocs, 8,123 frees, 1,344,364 bytes allocated
==23696==
==23696== All heap blocks were freed -- no leaks are possible
==23696==
==23696== For lists of detected and suppressed errors, rerun with: -s
==23696== ERROR SUMMARY: 213 errors from 38 contexts (suppressed: 0 from 0)

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature
    Need to add documentation about new configuration values that enables Explored Related experience for users.

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

zhihonl added 3 commits April 11, 2025 14:45
Signed-off-by: Zhihong Lin <zhiholin@amazon.com>
Signed-off-by: Zhihong Lin <zhiholin@amazon.com>
Signed-off-by: Zhihong Lin <zhiholin@amazon.com>
Signed-off-by: Zhihong Lin <zhiholin@amazon.com>
Signed-off-by: Zhihong Lin <zhiholin@amazon.com>
Signed-off-by: Zhihong Lin <zhiholin@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant