Skip to content

Fix Container Insights logs - #2221

Open
Paamicky wants to merge 3 commits into
mainfrom
mcommey/containerinsights
Open

Fix Container Insights logs#2221
Paamicky wants to merge 3 commits into
mainfrom
mcommey/containerinsights

Conversation

@Paamicky

@Paamicky Paamicky commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description of changes

Container Insights logs enabled via the OTEL path (role: node + logs.enabled: true) never reach CloudWatch, the exporter 400s with "log group cannot be null or empty" and records are dropped. Root cause: batch/cw_k8s_ci_v0_logs_dest had no metadata_keys, so the batch processor discards the request context. That drops aws.log.group.name/aws.log.stream.name, so headers_setter emits an empty x-aws-log-group header

To fix this, we refactor the CI log pipelines into source pipelines that forward into the existing shared logs/opentelemetry export pipeline. That shared pipeline already has the correct batch with metadata_keys which fixes the bugs and CI logs reach CloudWatch now.

Changes:

  • filelog_app.yaml / filelog_node.yaml: CI log pipelines now export to forward/opentelemetry; removed the CI-specific sigv4auth, headers_setter, awscloudwatchlogsprovisioner, otlphttp/*_logs_dest, batch, and attributestocontext.
  • Activate the shared logs/opentelemetry pipeline for CI via baseLogsTranslator which depends on containerinsights.HasLogPipelines
  • Golden yaml coverage: split sample into container_insights_node_config (role node, logs on) and container_insights_cluster_config (role cluster) and regenerate expected YAMLs.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Tests

  • CWAgent translator yaml now shows CI logs forwarding into the shared logs/opentelemetry pipeline.
  • EKS (cwagent-sandbox): CI metrics + app logs flow through the shared pipeline; /aws/otel/containerinsights/mcommey-otelci-shared/application created,
  • CloudWatch console / query studio: metrics visible via @resource.k8s.cluster.name.
Screenshot 2026-07-31 at 13 07 55 Screenshot 2026-07-31 at 13 07 17

@Paamicky Paamicky added the ready for testing Indicates this PR is ready for integration tests to run label Jul 30, 2026
@Paamicky
Paamicky marked this pull request as ready for review July 30, 2026 18:11
@Paamicky
Paamicky requested a review from a team as a code owner July 30, 2026 18:11
@Paamicky
Paamicky requested review from TravisStark and jefchien July 30, 2026 18:11
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Binary Size Report

linux/amd64

Binary PR vs main (4753aac) vs v1.300070.0
amazon-cloudwatch-agent 193.2 MB ${\color{green}▼}$ 4.1 KB (-0.0%) ${\color{green}▼}$ 38.1 MB (-16.5%)
amazon-cloudwatch-agent-config-wizard 2.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+4.5%)
config-downloader 2.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+4.5%)
config-translator 2.0 MB +0 B ${\color{red}▲}$ +86.0 KB (+4.5%)
start-amazon-cloudwatch-agent 2.5 MB +0 B ${\color{red}▲}$ +81.9 KB (+3.4%)
workload-discovery 3.0 MB +0 B ${\color{red}▲}$ +94.2 KB (+3.2%)
Total 204.8 MB ${\color{green}▼}$ 4.1 KB (-0.0%) ${\color{green}▼}$ 37.7 MB (-15.5%)
linux/amd64 amazon-cloudwatch-agent (last 9 main commits + this PR)

 193 ┤                                        
     ┤        ███ ███ ███ ███ ███ ███ ███     
     ┤        ███ ███ ███ ███ ███ ███ ███     
     ┤        ███ ███ ███ ███ ███ ███ ███ ███ 
     ┤    ▄▄▄ ███ ███ ███ ███ ███ ███ ███ ███ 
     ┤    ███ ███ ███ ███ ███ ███ ███ ███ ███ 
     ┤    ███ ███ ███ ███ ███ ███ ███ ███ ███ 
     ┤    ███ ███ ███ ███ ███ ███ ███ ███ ███ 
 193 ┤▄▄▄ ███ ███ ███ ███ ███ ███ ███ ███ ███ 
 MB  └────────────────────────────────────────
      7b0a665                             PR
linux/arm64
Binary PR vs main (4753aac) vs v1.300070.0
amazon-cloudwatch-agent 176.9 MB +0 B ${\color{green}▼}$ 34.5 MB (-16.3%)
amazon-cloudwatch-agent-config-wizard 2.0 MB +0 B ${\color{green}▼}$ 22 B (-0.0%)
config-downloader 2.0 MB +0 B ${\color{green}▼}$ 22 B (-0.0%)
config-translator 2.0 MB +0 B ${\color{green}▼}$ 22 B (-0.0%)
start-amazon-cloudwatch-agent 2.4 MB +0 B ${\color{red}▲}$ +65.5 KB (+2.8%)
workload-discovery 2.9 MB +0 B ${\color{red}▲}$ +65.5 KB (+2.3%)
Total 188.2 MB +0 B ${\color{green}▼}$ 34.4 MB (-15.5%)
windows/amd64
Binary PR vs main (4753aac) vs v1.300070.0
amazon-cloudwatch-agent.exe 196.0 MB ${\color{red}▲}$ +4.1 KB (+0.0%) ${\color{green}▼}$ 38.2 MB (-16.3%)
amazon-cloudwatch-agent-config-wizard.exe 2.1 MB +0 B ${\color{red}▲}$ +130.6 KB (+6.5%)
config-downloader.exe 2.1 MB +0 B ${\color{red}▲}$ +130.0 KB (+6.5%)
config-translator.exe 2.1 MB +0 B ${\color{red}▲}$ +130.6 KB (+6.5%)
start-amazon-cloudwatch-agent.exe 2.3 MB +0 B ${\color{red}▲}$ +112.1 KB (+5.2%)
workload-discovery.exe 2.9 MB +0 B ${\color{red}▲}$ +97.3 KB (+3.5%)
Total 207.7 MB ${\color{red}▲}$ +4.1 KB (+0.0%) ${\color{green}▼}$ 37.6 MB (-15.3%)
Investigating size changes

Use go-size-analyzer to compare binaries:

GOEXPERIMENT=jsonv2 go install github.com/Zxilly/go-size-analyzer/cmd/gsa@latest
gsa diff --old <baseline-binary> --new <new-binary>

Comment on lines +4 to +23
otlphttp/cw_k8s_ci_v0_app_logs_dest:
auth:
authenticator: headers_setter/cw_k8s_ci_v0_app_logs
compression: none
endpoint: https://logs.us-east-1.amazonaws.com:443
sending_queue:
num_consumers: 10
queue_size: 500
tls:
insecure: false
otlphttp/cw_k8s_ci_v0_node_logs_dest:
auth:
authenticator: headers_setter/cw_k8s_ci_v0_node_logs
compression: none
endpoint: https://logs.us-east-1.amazonaws.com:443
sending_queue:
num_consumers: 10
queue_size: 500
tls:
insecure: false

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.

Any reason why we have separate exporters for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed to use shared logs pipelines

Comment on lines +64 to +81
headers_setter/cw_k8s_ci_v0_app_logs:
additional_auth: awscloudwatchlogsprovisioner/cw_k8s_ci_v0_logs
headers:
- action: upsert
from_context: aws.log.group.name
key: x-aws-log-group
- action: upsert
from_context: aws.log.stream.name
key: x-aws-log-stream
headers_setter/cw_k8s_ci_v0_node_logs:
additional_auth: awscloudwatchlogsprovisioner/cw_k8s_ci_v0_logs
headers:
- action: upsert
from_context: aws.log.group.name
key: x-aws-log-group
- action: upsert
from_context: aws.log.stream.name
key: x-aws-log-stream

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.

These are exactly the same.

@Paamicky Paamicky Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed to use shared logs pipelines

Comment on lines +87 to +89
sigv4auth/cw_k8s_ci_v0_logs_dest:
region: us-east-1
service: logs

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.

Should use the shared sigv4auth extension.

@Paamicky Paamicky Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed to use shared logs pipelines

@Paamicky
Paamicky force-pushed the mcommey/containerinsights branch from 6e5be83 to 71244d2 Compare July 31, 2026 17:38
@Paamicky
Paamicky force-pushed the mcommey/containerinsights branch from fc9cd9b to c80cee5 Compare July 31, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for testing Indicates this PR is ready for integration tests to run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants