Monitoring AWS Lambda Logs with ClickStack using Rotel
This guide shows you how to monitor AWS Lambda functions with ClickStack by using the Rotel Lambda Extension to collect and forward function logs, extension logs, and OpenTelemetry data directly to ClickHouse. You'll learn how to:
- Deploy the Rotel Lambda Extension layer to your Lambda functions
- Configure the extension to export logs and traces to ClickStack
- Optionally disable CloudWatch Logs to reduce costs
This approach can significantly reduce your Lambda observability costs by bypassing CloudWatch Logs entirely.
Time Required: 5-10 minutes
Integration with existing Lambda functions
This section covers configuring your existing AWS Lambda functions to send logs and traces to ClickStack using the Rotel Lambda Extension.
Prerequisites
- ClickStack instance running
- AWS Lambda function(s) to monitor
- AWS CLI configured with appropriate permissions
- Lambda execution role with permissions to add layers
Choose the appropriate Rotel Lambda Extension layer
The Rotel Lambda Extension is available as a pre-built AWS Lambda layer. Choose the layer ARN that matches your Lambda function's architecture:
| Architecture | ARN Pattern | Latest Version |
|---|---|---|
| x86-64/amd64 | arn:aws:lambda:{region}:418653438961:layer:rotel-extension-amd64-alpha:{version} | |
| arm64 | arn:aws:lambda:{region}:418653438961:layer:rotel-extension-arm64-alpha:{version} |
Available regions:
- us-east-2, us-west-2
- eu-central-1, eu-north-1, eu-west-3
- ca-central-1
- ap-southeast-2, ap-northeast-2
- ap-south-1
- sa-east-1
Add the Rotel layer to your Lambda function
In these examples replace {arch}, {region}, and {version} with the appropriate values above.
Option 1: AWS Console
- Open the AWS Lambda console
- Navigate to your Lambda function
- Scroll to the Layers section and click Add a layer
- Select Specify an ARN
- Enter the Rotel layer ARN:
- Click Add
Option 2: AWS CLI
Option 3: AWS SAM
Configure the extension to export to ClickStack
The Rotel Lambda Extension is configured using environment variables. You need to configure the OTLP exporter endpoint to point to your ClickStack instance. The examples assume your AWS Lambda function is able to reach the ClickStack instance.
Basic configuration (environment variables)
Add these environment variables to your Lambda function:
Advanced configuration (using .env file)
For more complex configurations, create a rotel.env file in your Lambda function bundle:
rotel.env:
Then set the environment variable to point to this file:
Using AWS Secrets Manager or Parameter Store
For production deployments, store sensitive values like API keys in AWS Secrets Manager or Parameter Store:
AWS Secrets Manager Example:
AWS Parameter Store Example:
Required IAM Permissions:
Add these permissions to your Lambda execution role:
For Secrets Manager:
For Parameter Store:
AWS API calls for secret retrieval add 100-150ms to cold start latency. Secrets are retrieved in batches (up to 10) and only on initialization, so subsequent invocations are not impacted.
Test the integration
Invoke your Lambda function to verify logs are being sent to ClickStack:
Check the Lambda logs for any errors:
Verify logs in HyperDX
Once configured, log into HyperDX (ClickStack's UI) and verify that logs are flowing:
Look for these key attributes in the logs:
service.name: Your Lambda function namefaas.name: AWS Lambda function namefaas.invocation_id: Unique invocation IDcloud.provider: "aws"cloud.platform: "aws_lambda"
Disabling CloudWatch Logs (cost optimization)
By default, AWS Lambda sends all logs to CloudWatch Logs, which can be expensive at scale. Once you've verified that logs are flowing to ClickStack, you can disable CloudWatch logging to reduce costs.
Remove CloudWatch permissions from the execution role
- Open the AWS Console and navigate to AWS Lambda
- Navigate to your Lambda function
- Select Configuration → Permissions
- Click the execution role name to open the IAM console
- Edit the role and remove any
logs:*actions:- If using a custom policy, edit to remove
logs:CreateLogGroup,logs:CreateLogStream, andlogs:PutLogEvents - If using the AWS managed policy
AWSLambdaBasicExecutionRole, remove it from the role
- If using a custom policy, edit to remove
- Save the role
Verify CloudWatch logging is disabled
Invoke your function again and verify that:
- No new CloudWatch log streams are created
- Logs continue to appear in ClickStack/HyperDX
Adding OpenTelemetry auto-instrumentation
The Rotel Lambda Extension works seamlessly with OpenTelemetry auto-instrumentation layers to collect distributed traces and metrics in addition to logs.
Choose your language instrumentation layer
AWS provides OpenTelemetry auto-instrumentation layers for multiple languages:
| Language | Layer ARN Pattern |
|---|---|
| Node.js | arn:aws:lambda:{region}:901920570463:layer:aws-otel-nodejs-{arch}-ver-{version} |
| Python | arn:aws:lambda:{region}:901920570463:layer:aws-otel-python-{arch}-ver-{version} |
| Java | arn:aws:lambda:{region}:901920570463:layer:aws-otel-java-agent-{arch}-ver-{version} |
Find the latest versions in the AWS OpenTelemetry Lambda repository.
Configure the auto-instrumentation
Set the AWS_LAMBDA_EXEC_WRAPPER environment variable to enable auto-instrumentation:
For Node.js:
For Python:
For Java:
Verify traces in HyperDX
After invoking your function:
- Navigate to the Traces view in HyperDX
- You should see traces with spans from your Lambda function
- Traces will be correlated with logs via
trace_idandspan_idattributes
Example applications
Checkout the example Python app demonstrating the Rotel Lambda Extension:
- Python + ClickHouse: Python application with manual OpenTelemetry instrumentation, sending traces and logs directly to ClickHouse
Join the Rotel community
If you have questions about Rotel, please join the Rotel Discord server and share your feedback or questions. Check out the Rotel Lambda Extension to contribute any improvements.
Additional resources
- Rotel Lambda Extension: Source code and detailed documentation
- Rotel Core: The lightweight OTEL data plane powering the extension