A serverless logs exporter. Photo by Satyakam Kanaglekar: https://www.pexels.com/photo/truck-carrying-wood-logs-11765701/
Integrating AWS CloudWatch with third-party observability tools can be a game-changer for monitoring serverless services.
This blog post will explain why you should integrate CloudWatch with a third-party observability tool in a serverless services environment.
You will also learn how to export CloudWatch logs effectively using serverless technology to third-party observability tools such as DataDog, Grafana, and others to simplify log management and provide deeper insights into your services' performance.
The Serverless Case for Exporting CloudWatch Logs
Monitoring a serverless service starts with service logs. AWS Lambda and CloudWatch have a native and transparent integration. Lambda functions output their logs to CloudWatch log groups by default. You can learn more about logging best practices in a previous post here.
Once the logs appear in the CloudWatch console, the next step in monitoring your service is to build a dashboard. You can learn more about dashboard building best practices in a previous post here.
Some companies prefer third-party observability tools such as Grafana Cloud, DataDog, and others, due to their ease of use and other advanced features.
So why should you keep using CloudWatch? Why not just output the logs directly to a third-party observability tool?
If you use serverless technology, it makes more sense to keep using CloudWatch as the default logs output. Here's why:
To summarize, writing Lambda function logs to CloudWatch instead of directly exporting them to the third-party tool means better performance, fewer deployment dependencies, and a more effortless switch to a different third-party tool in the future, but these features come at an added cost.
Now, all that's left to do is to implement a centralized logs exporter that will send CloudWatch logs to a third party of your choice without impacting any of your services.
CloudWatch Logs Serverless Exporters
We will review several designs for a centralized logs exporter. You will deploy it in your accounts across the organization, and it will make sure the logs are exported to the third-party tool. As noted before, your serverless services are unaware of the logs exporter or the third-party tools.
As of May 1st 2025, Lambda function have a dedicated logging destination for S3 or Firehose. Thus making the CloudWatch subscription design below not needed! Each function can send its logs directly to a Firehose, and not store logs on CW, thus reducing cost!
The following designs rely on a CloudWatch subscription capability to subscribe log groups to a destination, meaning CloudWatch sends log streams to a destination of your choice: Kinesis DataStream, Amazon OpenSearch, Lambda function, or Kinesis Firehose.
These are the possible options for the design entry points.
You can use subscriptions to get access to a real-time feed of log events from CloudWatch Logs and have it delivered to other services such as an Amazon Kinesis stream, an Amazon Kinesis Data Firehose stream, or AWS Lambda for custom processing, analysis, or loading to other systems. When log events are sent to the receiving service, they are base64 encoded and compressed with the gzip format.
You can add a filter to select what log groups you don't want to export. For more information, refer to the documentation.

We will review several log exporter designs, discuss their pros and cons, and how easy it is to switch between third parties.
All the designs rely on serverless architecture to keep the management and maintainability costs as low as possible.
Please note that I do not cover costs in this post. Make sure to calculate a design of your choice and match it to your needs and budget.
Kinesis Firehose
In the following design, we will use Kinesis Firehose as the entry point that receives a batch of logs. When log events are sent to the receiving service, they are base64 encoded and compressed with the gzip format, according to the documentation.
FireHose can invoke a transformation Lambda function per batch. The Lambda function can process the batch, alter it, and return the processed output to Firehose. The function has five minutes per batch to process it. The transformation Lambda provides several powerful capabilities that you can implement:
Once processed, Firehose sends the batch to an HTTP endpoint destination. You can send it to AWS observability partners such as Datadog, Dynatrace, LogicMonitor, MongoDB, New Relic, Splunk, or Sumo Logic.

Pros:
Cons:
If a response fails to conform to the requirements below, the Kinesis Firehose server treats it as though it had a 500 status code with no body. - AWS
Kinesis DataStreams & EventBridge Pipes
One of the major cons of the previous design was that not ALL third-party observability tools are supported, for example, Grafana. The following two designs solve that and allow you to export to any third-party tool. Let's review the first design.
This design came to reality from a discussion with a fellow AWS serverless hero, Aidan Steele, who suggested EventBridge pipes as an option. Thank you Aidan!
In this example, we will subscribe our logs to Kinesis DataStreams. We will set the output of the DataStreams to an EventBridge Pipe. We cannot use Firehose as an entry point because it does not support export to an EventBridge pipe.

Pipes are intended for point-to-point integrations between supported sources and targets, with support for advanced transformations and enrichment. It reduces the need for specialized knowledge and integration code when developing event-driven architectures
EventBridge pipes will get a batch of logs from Kinesis DataStreams, trigger an enrichment Lambda function, and send the batch to an API destination of our choice over HTTPS.

In this example, we will export the logs to Grafana.
You can use EventBridge Pipe's filter capabilities, but since the logs are gzipped, filtering logs in the enrichment Lambda is simpler.
The enrichment Lambda function will can implement similar capabilities to the transformation Lambda in the Firehose design:

The enrichment Lambda returns the payload that contains the filtered and enriched logs in the format that a specific third party expects. The EventBridge pipe then sends the payload to the API destination.
EventBridge supports sending failures with debug information to an S3 similar to Firehose. This is a new capability that was announced in Nov 15th 2023 -
Pros:
Cons:
Kinesis DataStreams & Lambda Function
This third design replaces the EventBridge Pipes and gives you ultimate control regarding error handling and retries at the cost of extra code.

We will replace EventBridge Pipes with a Lambda Function as described here.
This sole function is now required to process our logs, filter, enrich, remove PII, and send the batch to the third party with an HTTP request. It must retry, handle errors, and send failed batches or log entries to the backup S3 bucket.
If you think the function does too much, you can split the function into two with an SQS in between: function (filter, enrich, PII) -> SQS -> function (export, send failures to S3), where the second function handles the export to the third party. This design is more robust but adds latency to the export process.
Pros:
Cons:
Summary
We've covered three serverless designs to export CloudWatch logs to third parties.
Each has its pros and cons. First, select the third party that fits your observability requirements, then choose the design that can matches your third-party.
Remember to estimate the export costs and design the deployment mechanism to deploy the logs exporter across your organization. Be sure to manage it via infrastructure as code (IaC) so it is easy to deploy, manage and upgrade across the organization.




