Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/concepts/otlp/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,7 @@ The following SDKs have dedicated integrations that make OTLP setup easy:
label="Python"
url="/platforms/python/integrations/otlp"
/>

## OpenTelemetry Collector Guides

View the [OpenTelemetry Collector Guides](/product/drains/integration/opentelemetry-collector/#open-telemetry-collector-guides) to learn how to leverage the OpenTelemetry Collector to send traces and logs to Sentry from different sources like Kafka or Nginx.
10 changes: 10 additions & 0 deletions docs/product/drains/integration/opentelemetry-collector.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,13 @@ service:
receivers: [routing]
exporters: [otlphttp/project-b]
```

## OpenTelemetry Collector Guides

These guides show you how to leverage the OpenTelemetry Collector to send traces and logs to Sentry from different sources.

- [Forwarding AWS CloudWatch Logs to Sentry](/product/drains/otlp-guides/aws-cloudwatch/)
- [Forwarding Logs and Traces from Kafka to Sentry](/product/drains/otlp-guides/kafka/)
- [Forwarding Nginx Logs to Sentry](/product/drains/otlp-guides/nginx/)
- [Forwarding Syslog Messages to Sentry](/product/drains/otlp-guides/syslog/)
- [Forwarding Windows Event Logs to Sentry](/product/drains/otlp-guides/windows-events/)
199 changes: 199 additions & 0 deletions docs/product/drains/otlp-guides/aws-cloudwatch.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
---
title: Forwarding AWS CloudWatch Logs to Sentry via the OpenTelemetry Protocol (OTLP)
sidebar_order: 100
description: "Learn how to forward AWS CloudWatch logs to Sentry via the OpenTelemetry Protocol (OTLP)."
keywords:
["otlp", "otel", "opentelemetry", "aws", "cloudwatch", "logs", "amazon"]
---

This guide shows you how to collect AWS CloudWatch logs and forward them to Sentry using the OpenTelemetry Collector with the [AWS CloudWatch Receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/awscloudwatchreceiver).

## Prerequisites

Before you begin, ensure you have:

- AWS credentials configured with permissions to read CloudWatch logs
- A Sentry project to send data to

## Step 1: Install the OpenTelemetry Collector

The AWS CloudWatch Receiver is included in the [OpenTelemetry Collector Contrib](https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib) distribution. You'll need to download and install this version, as the standard `otelcol` binary does not include the AWS CloudWatch Receiver.

Download the latest `otelcol-contrib` binary from the [OpenTelemetry Collector releases page](https://github.com/open-telemetry/opentelemetry-collector-releases/releases).

## Step 2: Configure AWS Credentials

The AWS CloudWatch Receiver uses the [AWS SDK](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html) for authentication, which supports multiple methods including credentials files and EC2 instance metadata (IMDS).

### Using an AWS Credentials File

Configure your AWS credentials using the AWS CLI:

```bash
aws configure
```

This creates a credentials file at `~/.aws/credentials` with your access key and secret.

### Using IAM Role (EC2)

For EC2 environments, attach an IAM role with the `CloudWatchLogsReadOnlyAccess` policy to your instance.

### Required IAM Permissions

Your AWS credentials need the following permissions:

- `logs:DescribeLogGroups`
- `logs:DescribeLogStreams`
- `logs:GetLogEvents`

## Step 3: Get Your Sentry OTLP Credentials

You'll need your Sentry OTLP endpoint and authentication header. These can be found in your [Sentry Project Settings](https://sentry.io/settings/projects/) under **Client Keys (DSN)** > **OpenTelemetry (OTLP)**.

### Logs Endpoint

```bash
___OTLP_LOGS_URL___
```

### Authentication Header

```
x-sentry-auth: sentry sentry_key=___PUBLIC_KEY___
```

## Step 4: Configure the Collector

Create a configuration file with the AWS CloudWatch Receiver and the OTLP HTTP exporter configured to send logs to Sentry.

For additional configuration options, see the [AWS CloudWatch Receiver Documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/awscloudwatchreceiver).

### Collect All Log Groups (Autodiscover)

This configuration automatically discovers and collects logs from all CloudWatch log groups:

```yaml {filename:config.yaml}
receivers:
awscloudwatch:
region: us-east-1
logs:
poll_interval: 1m

processors:
batch:
send_batch_size: 1024
send_batch_max_size: 2048
timeout: "1s"

exporters:
otlphttp/sentry:
logs_endpoint: ___OTLP_LOGS_URL___
headers:
x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
compression: gzip
encoding: proto

service:
pipelines:
logs:
receivers:
- awscloudwatch
processors:
- batch
exporters:
- otlphttp/sentry
```

### Collect Specific Log Groups by Prefix

This configuration discovers log groups matching a specific prefix, useful for collecting logs from specific AWS services like EKS or Lambda:

```yaml {filename:config.yaml}
receivers:
awscloudwatch:
region: us-east-1
logs:
poll_interval: 1m
groups:
autodiscover:
limit: 100
prefix: /aws/lambda/

processors:
batch:
send_batch_size: 1024
send_batch_max_size: 2048
timeout: "1s"

exporters:
otlphttp/sentry:
logs_endpoint: ___OTLP_LOGS_URL___
headers:
x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
compression: gzip
encoding: proto

service:
pipelines:
logs:
receivers:
- awscloudwatch
processors:
- batch
exporters:
- otlphttp/sentry
```

### Collect Named Log Groups

This configuration collects logs from specific, named log groups:

```yaml {filename:config.yaml}
receivers:
awscloudwatch:
region: us-east-1
logs:
poll_interval: 1m
groups:
named:
/aws/lambda/my-function:
/aws/eks/my-cluster/cluster:

processors:
batch:
send_batch_size: 1024
send_batch_max_size: 2048
timeout: "1s"

exporters:
otlphttp/sentry:
logs_endpoint: ___OTLP_LOGS_URL___
headers:
x-sentry-auth: "sentry sentry_key=___PUBLIC_KEY___"
compression: gzip
encoding: proto

service:
pipelines:
logs:
receivers:
- awscloudwatch
processors:
- batch
exporters:
- otlphttp/sentry
```

## Troubleshooting

- Verify your AWS credentials are correctly configured and have the required permissions
- Ensure the specified AWS region matches where your CloudWatch log groups are located
- Check that the log group names or prefixes match existing CloudWatch log groups

## Additional Resources

- [AWS CloudWatch Receiver Documentation](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/awscloudwatchreceiver)
- [AWS SDK Authentication](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html)
- [Sentry OpenTelemetry Collector Configuration](/product/drains/integration/opentelemetry-collector/)
- [Sentry Logs](/product/explore/logs/)
Loading
Loading