-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
The purpose and use-cases of the new component
Summary
Add a new awslambdareceiver component that receives AWS Lambda invocations and decodes messages using provided encoding extensions. This receiver is designed to run as part of an OpenTelemetry Collector deployed as an AWS Lambda function.
Motivation
AWS Lambda is a popular serverless service used extensively for event-driven architectures. Many AWS services (S3, CloudWatch, SNS, SQS) can trigger Lambda functions, making it an ideal entry point for collecting data from AWS services.
The awslambdareceiver enables users to:
- Collect logs stored in AWS S3 buckets (VPC Flow Logs, ELB Access Logs, CloudTrail, WAF, S3 Access Logs, etc.)
- Ingest CloudWatch Logs via subscription filters
- Process custom JSON logs stored in S3
- Leverage OpenTelemetry's encoding extensions for message parsing
Primary Use Cases
- S3-triggered Log Collection: Lambda is invoked by S3 event notifications when new log files are created
- CloudWatch Logs: Lambda is invoked by CloudWatch Logs subscription filters
Design
The awslambdareceiver operates as follows:
- Accepts Lambda Invocations
- Identifies the event source (S3, CloudWatch, etc.)
- Uses configured encoding extensions to parse the data
- Creates OpenTelemetry log records
- Passes parsed logs to the collector pipeline
Supported Event Sources
- S3 Event Notifications (s3:ObjectCreated:*)
- Fetches objects from S3
- Decodes using specified encoding extension
- CloudWatch Logs Subscription Filters
- Decodes CloudWatch Logs data
- Extracts log events
Example configuration for the component
Example 1: VPC Flow Logs from S3
receivers:
awslambda:
s3_encoding: awslogs_encoding
failure_bucket_arn: <Optional arn of an existing s3 bucket to store failed lambda invocation events>
extensions:
awslogs_encoding:
format: vpcflow
vpcflow:
file_format: plain-text
exporters:
otlphttp:
endpoint: "https://my-backend:443"
service:
extensions:
- awslogs_encoding
pipelines:
logs:
receivers: [awslambda]
exporters: [otlphttp]In this example, awslambdareceiver receives a notification when a new VPC flow log file is stored in an S3 bucket. The receiver fetches the log file from S3 and parses it using the awslogs_encoding extension with vpcflow format. The parsed logs are then sent to an OTLP listener using the otlphttp exporter.
Example 2: CloudWatch Logs Subscription
receivers:
awslambda:
failure_bucket_arn: "my-bucket-arn"
exporters:
otlphttp:
endpoint: "https://my-backend:443"
service:
pipelines:
logs:
receivers: [awslambda]
exporters: [otlphttp]In this example, awslambdareceiver is invoked by a CloudWatch Logs subscription filter. The receiver automatically parses the CloudWatch Logs data using the default awslogs_encoding extension with cloudwatch format. No explicit encoding configuration is needed. The parsed logs are then sent to an OTLP listener using the otlphttp exporter.
Telemetry data types supported
- Logs (Primary support)
- Metrics (Future consideration)
Code Owner(s)
@MichaelKatsoulis, @Kavindu-Dodan
Sponsor (optional)
Additional context
This component is currently implemented and used by Elastic's EDOT Cloud Forwarder for AWS. We propose open sourcing it to benefit the broader OpenTelemetry community.
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.