Skip to content

AWSCloudWatch and awsemf exporters do not support role_arn AWS STS auth #42115

@pavolloffay

Description

@pavolloffay

Component(s)

exporter/awscloudwatchlogs

What happened?

Description

The role_arn support was removed from cloudwach exporter in
99934f4#diff-f44af95874288433fb5e94e9bbb285bcced86e0a67770e04c30d3eb219401194

Steps to Reproduce

Create a collector with awscloudwatch exporter and role_arn.

Expected Result

Actual Result

Collector version

0.132.0 or main/HEAD

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: my-otel-collector
spec:
  # ... other OpenTelemetry Collector configuration ...

  # This is where you add environment variables
  env:
    - name: AWS_ENDPOINT_URL_CLOUDWATCHLOGS
      value: "https://add-cloudwatch-endpoint-here"
  
  # Ensure you remove the 'endpoint' from the exporter config if you're using the env var
  config: |
    exporters:
      awscloudwatchlogs:
        role_arn: arn:aws:iam::<masked account number>:role/CloudWatchAgentServer-CrossAccountSharingRole
        log_group_name: "/aws/rosa/logs/sb-replica-rosa-01"
        log_stream_name: ${NODE_NAME}
        log_retention: 3
        region: me-central-1
        # IMPORTANT: Remove the 'endpoint' field here
        # endpoint: https://.  <-- REMOVE THIS LINE
    # ... rest of your collector config ..

Log output

2025-07-22T12:02:16.466Z        info    internal/retry_sender.go:133    Exporting failed. Will retry the request after interval.        {"resource": {}, "otelcol.component.id": "awscloudwatchlogs", "otelcol.component.kind": "exporter", "otelcol.signal": "logs", "error": "error flushing logs: operation error CloudWatch Logs: PutLogEvents, https response error StatusCode: 400, RequestID: 388627df-8a4b-4c17-a0b1-7901b57a0261, api error AccessDeniedException: User: arn:aws:sts::<account>:assumed-role/sb-rep-rosa-01-account-Worker-Role/<masked> is not authorized to perform: logs:PutLogEvents on resource: arn:aws:logs:me-central-1:<account>:log-group:/aws/rosa/logs/sb-replica-rosa-01:log-stream:<masked>.me-central-1.compute.internal because no identity-based policy allows the logs:PutLogEvents action", "interval": "34.613421457s"}

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions