Sending Amazon CloudWatch Logs to Loki

Moving log analysis off CloudWatch Logs means streaming it through Amazon Data Firehose into Grafana Alloy and self-hosted Loki. This page covers the documented path, labels, what stays in CloudWatch and the effort drivers.

On this page

Sending CloudWatch Logs to Loki: what the move involves

Most teams moving CloudWatch Logs to self-hosted Loki are doing so because their engineers already query logs in CloudWatch Logs Insights and now want Grafana and Loki running in infrastructure they control. The effort is less about the streaming itself and more about what sits on either side of it. The path is Amazon Data Firehose delivering to Grafana Alloy's loki.source.awsfirehose receiver, which forwards entries to a Loki write component. Before any of that work starts, Loki must already be deployed, placed behind an authenticating reverse proxy (Loki has no built-in authentication layer), and backed by object storage. Confirm those three things in your own environment first, because a streaming pipeline cannot be tested end to end until Loki accepts writes from a tenant you have defined.

Start by confirming the account side of the move. Inventory the log groups you need, the AWS accounts and Regions that hold them, and which of them carry data that must stay inside your boundary. Decide whether a Firehose delivery stream will be created per account, per Region or per group of log groups, because that choice determines how many receivers and endpoints Alloy must expose and how Firehose authenticates to them. Check with your AWS administrators which IAM roles, subscription filters and Firehose delivery settings your organization permits, and whether CloudWatch Logs subscription filters are already in use for other destinations, since their limits affect the design. Also confirm the network path from Firehose to your Alloy endpoint, including TLS and whether the endpoint sits behind your existing gateway.

Plan what stays in CloudWatch. Retaining a copy in CloudWatch Logs is often the right choice for compliance evidence, cross-account audit trails or alarms that already depend on metric filters, so decide that per log group rather than by default. Labels for log group and account are the main design decision on the Loki side: they should be few, stable and derived from the source, and they must match the tenant and access model you intend to use. Ask your Loki operators to confirm how tenant IDs are set through the X-Scope-OrgID header and how the reverse proxy maps users to tenants. Finally, agree on how you will verify the result: compare event counts for a sample window between CloudWatch and Loki, and confirm that queries in Grafana return the expected entries before you retire any CloudWatch workflow.

Which CloudWatch Logs capabilities map to Loki and which do not

This table compares the main CloudWatch Logs features your team uses today with their nearest counterpart in self-hosted Loki. Read the middle column for what carries over and the last column for what you must rebuild, replace or decide before cutover. Gaps marked as rebuild items need owners and tests in your migration plan.

CloudWatch Logs capabilityNearest Loki equivalentMigration note
Log groups and log streamsLabels on log streams, such as a log group label and an account labelChoose a small, fixed set of labels. Each unique label combination creates a separate stream, so avoid putting request IDs or user IDs in labels.
Subscription filters into FirehoseAmazon Data Firehose delivering to Grafana Alloy's loki.source.awsfirehose receiverConfirm the Firehose delivery stream, its HTTP endpoint and access settings in your own AWS account before routing production logs.
Logs Insights query languageLogQL, which has different syntax and no direct translationRewrite saved queries by hand and test each one against sample data. Do not assume Insights queries run unchanged.
Metric filters that create CloudWatch metricsLogQL metric queries and Loki ruler recording rulesMetrics produced by metric filters must be rebuilt as LogQL expressions. Confirm the output names and dashboards that depend on them.
CloudWatch alarms on log patternsLoki ruler alerting rules or Grafana Alerting, configured separatelyAlarms do not move automatically. Each alarm needs a rebuilt rule, a notification route and a test that it fires.
Retention settings per log groupCompactor retention, set globally, per tenant or per stream selectorRetention is disabled by default in Loki, so logs are kept until you enable it. Each stream rule must be at least 24 hours.
IAM-based access control to log groupsTenant headers (X-Scope-OrgID) with an authenticating reverse proxy in front of LokiLoki has no built-in authentication layer. Access rules must be designed in the proxy and in your tenant model, and tested end to end.
Cross-account access through resource policiesNo direct equivalent in open-source LokiPlan cross-account reads as a separate design. Enterprise label-based access control and cross-tenant queries belong to Grafana Enterprise Logs, which you should evaluate separately.

Documented components for the CloudWatch to Loki path

The CloudWatch to Loki path has three parts: a delivery service that sends log data out of AWS, a receiver that accepts it, and the Loki push path that stores it. Each part can be configured and tested on its own, so decide early which components you will run and who owns each one.

Amazon Data Firehose as delivery

Amazon Data Firehose is the AWS service that forwards CloudWatch Logs data to an HTTP endpoint you control. It runs inside your AWS account, so the delivery stream, its IAM role and its destination settings are part of your configuration to design and review. Confirm which log groups feed the stream, how subscription filters are set up across accounts, and how failed deliveries are retained and reprocessed. Those choices determine whether the receiver sees every record and whether gaps are visible.

Alloy loki.source.awsfirehose receiver

Grafana Alloy's loki.source.awsfirehose component accepts log entries over HTTP from Amazon Data Firehose, including CloudWatch logs and events. It then forwards entries to other loki components, such as a writer that pushes them to Loki. Plan where Alloy runs, how its HTTP endpoint is reached from AWS, and how access to that endpoint is restricted. Check the component's settings for request authentication and labeling before you rely on them in production.

Alloy component reference

Labels for log group and account

Labels such as log group and AWS account are what let you query CloudWatch data in Loki by source. Keep the label set small and stable, because each unique combination of label values creates a separate stream. Decide which values come from the Firehose record and which you add in Alloy, and confirm with your team how account identifiers will be named across environments. Log message content belongs in the log line, not in labels.

Loki send-data options for other shippers

Loki's send-data documentation lists Grafana Alloy as the supported log shipper, plus OpenTelemetry over HTTP, Fluent Bit, Fluentd and the Docker logging driver. Use these when some logs come from sources other than CloudWatch, so every stream follows one labeling convention. Confirm which path each source uses before you build the pipeline, and avoid sending the same logs through two shippers.

Loki send data docs

Loki push path and storage

The Loki push path is the write API that receives log streams from Alloy and stores compressed chunks and the index in object storage. Its behavior depends on the tenant header, the deployment mode and the storage backend you choose. Confirm how the write path will authenticate requests, since Loki has no built-in authentication layer, and size object storage and retention before go-live so the cluster can absorb the expected volume.

How CloudWatch log data flows into Loki

The flow starts when a CloudWatch Logs subscription filter sends log events to Amazon Data Firehose, which delivers them over HTTPS to the awsfirehose receiver in Grafana Alloy inside your network. Alloy forwards entries to a loki.write component, which pushes them into self-hosted Loki. Grafana reads from Loki only through the authenticating reverse proxy, so check that the Firehose endpoint is reachable from AWS and that only that proxy path reaches Loki.

Log events flow from CloudWatch Logs through Firehose and Alloy into Loki.

Sequence from inventory to decommissioning CloudWatch ingestion

This sequence moves CloudWatch log analysis onto self-hosted Loki in controlled stages, so each log group is proven in Loki before CloudWatch stops being the place people look. It also keeps the CloudWatch retention that audit and legal needs still require.

  1. Inventory log groups and retention requirements

    The cloud platform team lists every log group across the accounts in scope, with its owner, its volume, the services that write to it, and the dashboards, metric filters and alarms that read from it. For each group, the compliance or security owner records how long the logs must be kept and where. The output is a register that shows which groups will move, which will stay in CloudWatch for retention, and which can be retired. Confirm retention requirements with compliance owners rather than assuming them from the current CloudWatch settings.

  2. Pilot one log group in one account

    Choose a single log group in a single account, preferably one with moderate volume and a clear owner. Stream it through Amazon Data Firehose into a test Loki deployment and confirm that entries arrive complete, with timestamps and message content intact. The pilot is done when the owner can find the same events in Grafana that they see in CloudWatch Logs Insights, and when the team has recorded the Firehose delivery behavior and any dropped or malformed records.

  3. Configure Firehose and Alloy receiver

    Create the Firehose delivery stream that sends the pilot's CloudWatch log data to an HTTP endpoint exposed by Grafana Alloy. On the Alloy side, configure a loki.source.awsfirehose component to receive these entries and forward them to a loki.write component that points at your Loki cluster. Put the Alloy endpoint behind TLS and an access control mechanism that your security team has approved, since Loki itself has no built-in authentication layer. The step is complete when test events flow end to end and Alloy's health and logs show no delivery errors.

  4. Design labels for log group and account

    Set labels for the log group and the source account in the Alloy pipeline so each stream can be filtered and secured independently. Keep the label set small and stable, because high-cardinality values such as request IDs or per-event identifiers belong in the log content or structured metadata, not in labels. Record the final label names and their meaning in a shared document that query authors and tenant administrators can read. The output is an approved label schema that the pilot results have been checked against.

  5. Run a parallel period with CloudWatch still ingesting

    Keep the existing CloudWatch ingestion running while Loki receives the same log groups through Firehose. During this period, compare event counts, field values and timestamps for sampled time windows, and check for gaps caused by Firehose retries or Alloy restarts. Confirm that Loki storage, retention and query performance meet expectations for the actual volume. The parallel run ends when the owners of each migrated log group sign off on the comparison results in writing.

  6. Cut over dashboards and alerts

    Move each dashboard, saved query and alert that depends on CloudWatch Logs to LogQL queries against Loki, and test each one against known events. Where an alert depends on a CloudWatch metric filter, confirm that the equivalent LogQL expression fires on the same test conditions before disabling the original. Update runbooks so responders know where to search. The step is done when every migrated dashboard and alert has been tested and its owner has approved the switch.

  7. Stop ingestion and retain required CloudWatch logs

    Disable the CloudWatch subscription or Firehose path for each migrated log group only after its cutover is approved. Do not delete CloudWatch log groups that still carry required retention, and confirm the retention settings the register recorded for each one. For groups that move fully to Loki, document where the retained copy lives, who can access it and how it is deleted at the end of its period. The decommission is complete when the register shows each group's final state, its retention owner and the date ingestion stopped.

Choosing labels for log group and account

This is the smallest design: one stream per combination of CloudWatch log group and AWS account, with everything else left in the log line. It keeps the label set small and predictable, which is the main reason Loki recommends labels for low-cardinality values. Queries select a stream with label matchers first and then filter the text, so a team that mostly asks questions such as "what happened in this service's log group last night" gets fast answers from this layout.

  • Stream count: each log group in each account becomes one stream, so the number of streams grows with the number of log groups, not with the number of events.
  • Tenant alignment: if each account or business unit maps to its own tenant, the account label can sit alongside the tenant ID set through the X-Scope-OrgID header.
  • Query cost: text filters run across the selected streams, so broad searches over many log groups read more data.
  • Limited filtering: fields such as request ID or error code are not indexed and need line filters or parsers at query time.
  • Stability: log group names rarely change, which keeps label values stable over time.

Confirm the exact label names and values that your Alloy pipeline emits before you write dashboards or retention rules against them.

What to keep in CloudWatch after the move

Streaming logs to Loki does not mean CloudWatch can be emptied. Some records are the evidence that CloudWatch itself was used, some services depend on CloudWatch for their own delivery, and some alarms gate operations. Review each item below before changing any log group, subscription or retention setting.

Audit trails from CloudWatch itself

Records of who changed log groups, subscription filters, retention settings and Firehose delivery streams are usually held in AWS CloudTrail rather than in the log groups you are moving. Keep CloudTrail enabled and confirm where its events are stored and for how long. If you also copy these audit events into Loki, treat that copy as a second store with its own access controls, not as a replacement for the original trail. Confirm your compliance retention requirements before removing any source.

Service logs that depend on CloudWatch

Some AWS services write their logs to CloudWatch Logs as the only delivery target, and changing that target can stop the service's own logging. Inventory every service that writes to a log group, including Lambda, API Gateway, VPC flow logs and managed databases, and check whether each one can deliver elsewhere. Leave those log groups in place until the owning team confirms the new path works end to end.

Alarms and metric filters that gate operations

CloudWatch alarms and metric filters often drive paging, auto scaling or runbook actions. Loki does not evaluate those alarms for you, so a metric filter that stops receiving log events will fail silently. Before removing a log group, list every alarm that references it, decide whether the alarm moves to Loki alerting or stays in CloudWatch, and test the replacement with a known event.

The cost of keeping a copy

Keeping logs in both places means paying CloudWatch ingestion and storage on the original stream while also paying for transport, object storage and Loki capacity. Ask the team to model the overlap period and decide how long CloudWatch retention stays set to a short window. The duration of the overlap is a planning decision for your organization, and AWS pricing pages are the place to confirm current rates for your region.

Retention rules in both systems

CloudWatch and Loki each apply their own retention. Loki retention is disabled by default and logs are kept until retention_enabled is set, so a Loki cluster without that setting will grow without limit. Document the retention period for each log family in both systems, and confirm the chosen values against your compliance retention requirements before shortening any CloudWatch retention.

Loki retention default
Disabled
Loki retention docs

What drives the cost and duration of the move

This table lists the main factors that change the cost and effort of streaming CloudWatch Logs to self-hosted Loki, and whether each one is paid once or recurs. Use it to structure a request for quote so that each driver is priced against your own accounts, volumes and Loki cluster.

DriverWhy it changes cost or effortOne-time or recurring, and what to ask for
Accounts and log groupsEach account needs its own cross-account role and Firehose delivery stream, and each log group needs a subscription path, so setup scales with how many exist.One-time setup. Ask for the number of accounts, regions and log groups in scope, and whether the quote covers new groups added later.
Log volume and Firehose costFirehose charges and Alloy capacity both track ingested bytes, so high-volume groups drive sizing and ongoing spend.Recurring. Ask who pays for Firehose and CloudWatch ingestion, and what volume the Alloy sizing assumes.
Existing Loki sizing and deployment modeMonolithic, simple scalable and microservices deployments take different amounts of work to extend, and simple scalable is being deprecated with Loki 4.0.One-time for setup, recurring for capacity. Ask which deployment mode is in use and whether sizing is reviewed against the new volume.
Authentication and multi-tenancy in placeLoki has no built-in authentication, so an authenticating proxy must already exist for the Firehose endpoint. Tenant IDs must be set on every request if multi-tenancy is enabled.One-time for new work if the proxy and tenancy exist. Ask whether the quote includes a proxy, token handling and tenant mapping.
Label designLog group and account labels must be chosen so that queries stay fast and label cardinality stays bounded across many groups.One-time design, with periodic review as new groups appear. Ask for the label schema and who approves changes.
Dashboard and alert rebuildsCloudWatch Logs Insights queries and alarms do not carry over automatically, so each one must be rewritten in LogQL and Grafana.One-time. Ask for an inventory of existing queries and alarms and a count of those to rebuild.
Cross-account IAM and Firehose setupEach account needs roles, trust policies and subscription filters, and changes to these need review by the owning team.One-time for initial build, recurring for access reviews. Ask who owns the IAM changes and how they are documented.
Retention and what stays in CloudWatchDeciding which logs remain in CloudWatch for audit or cost reasons changes how much data is duplicated and retained in two places.Recurring storage cost in both systems. Ask which groups stay in CloudWatch and for how long, and who sets Loki retention.

What usually goes wrong with CloudWatch to Loki

Most problems in this pipeline come from defaults that were never reviewed: labels taken from source data, two shippers writing the same logs, an open ingestion endpoint, and retention that was never set. Each card names one of these and the check that prevents it.

High-cardinality labels from stream names

CloudWatch log stream names often embed instance IDs, container IDs, pod names or timestamps, and each unique value becomes a separate Loki stream if it is promoted to a label. Keep labels to bounded values such as log group, account and region, and keep the stream name as a line field or structured metadata that you filter on at query time. Before go-live, sample several days of incoming streams and count the distinct label sets the pipeline produces.

Loki send data docs

Duplicate logs during parallel run

Running CloudWatch Logs subscriptions and an existing collector against the same log groups during cutover doubles the data in Loki and skews every count-based alert and dashboard. Decide which path is authoritative for each log group, and switch subscriptions one group at a time. Compare event counts for the same window in CloudWatch and Loki before removing the old path.

Unauthenticated Loki endpoint exposed to Firehose

Loki has no built-in authentication layer, so the write path must sit behind an authenticating reverse proxy, and the Firehose delivery endpoint must be reachable only through it. Confirm that Firehose sends the access credential the proxy expects, and that the Alloy receiver is not bound to a public interface. Test by sending a request without credentials and confirming it is rejected.

Loki authentication docs

Retention left disabled

Loki retention is disabled by default, so logs streamed from CloudWatch are kept indefinitely unless you enable it. Set retention deliberately, either globally or per tenant or stream selector, and confirm the compactor is running and applying it. Agree the retention period with your compliance owner before the first production stream, because CloudWatch retention settings do not carry over.

Loki retention docs

Gaps in alert coverage

Alerts built in CloudWatch, such as metric filters on log groups, do not fire when the same events are only in Loki. Inventory every CloudWatch alarm and metric filter, then recreate each as a Loki ruler rule or Grafana alert and test it with a known event. Also alert on the pipeline itself, such as Firehose delivery errors and a drop in ingested lines, so a silent failure does not look like a quiet system.

Questions teams ask before sending CloudWatch Logs to Loki

What does moving CloudWatch Logs to Loki cost in effort?

Effort depends on how many log groups, accounts and downstream queries and alerts you need to carry over, more than on the Loki software itself, which is open source and carries no license fee. The main effort is one-time: designing the Firehose delivery path, deploying Grafana Alloy with its loki.source.awsfirehose receiver, building the label scheme for log group and account, and rebuilding dashboards and alerts that currently use CloudWatch Logs Insights. Recurring costs are the infrastructure you run (compute, object storage for chunks and index, and the Firehose and CloudWatch charges while both paths run) plus whatever support or retainer you agree on. Ask any partner for a quote built from a written list of log groups, volumes and queries in scope.

How long does a CloudWatch to Loki move take?

The duration is set by scope, not by the tools, so treat any single number as something to confirm against your own inventory. Teams usually spend the most time on the label design, the Firehose and Alloy configuration in each account, and parallel running so that alerts and dashboards are proven before CloudWatch paths are removed. A small set of log groups in one account moves much faster than many accounts with compliance-driven retention and audit requirements. Ask for a timeline in the written scope that names the phases, the log groups included in each phase and the acceptance checks for each.

What does the team need to provide for this work?

You need named owners for the AWS accounts, the networking path from Firehose to your Alloy endpoint, the Loki environment and its object storage, and the people who own each log group's alerts and dashboards. On the AWS side, someone must be able to create Firehose delivery streams and the IAM roles they use, and someone must be able to review the endpoint's authentication and transport settings. On the Loki side, the team needs to agree on tenant IDs if you separate teams or environments, and on the labels to keep low cardinality. Without these owners, the work stalls at the first access request.

Can our own team move CloudWatch Logs to Loki without a partner?

Yes, if your team already runs Linux services, Kubernetes or Docker, and has someone who can operate AWS delivery services and object storage. The work is well documented by Grafana, and the Alloy receiver for Firehose is a single component in the pipeline. What a partner usually adds is a fixed scope, a tested configuration and a review of security controls such as authentication in front of Loki, which Loki does not provide by itself and which must come from an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium. Decide based on who will operate the result after handover.

Can we turn off CloudWatch Logs once Loki is receiving logs?

Not immediately, and not for every log group. Keep CloudWatch Logs running in parallel until dashboards, alerts and audit queries have been checked against Loki, and until your retention and evidence requirements are met on the Loki side. Some teams keep CloudWatch for specific services, for AWS-native alarms that depend on CloudWatch metrics, or for log groups that other AWS services write to. Document each log group as one of three outcomes: moved, kept in CloudWatch, or retired. Confirm with your compliance team which records must remain available and where.

How is retention set in Loki for these logs?

Retention in Loki is applied by the compactor and is disabled by default, so logs are kept indefinitely until you set retention_enabled to true. You can define retention globally, per tenant, or per stream selector, and each stream rule must be at least 24 hours. For CloudWatch logs, map your existing retention periods per log group to Loki rules, using the account and log group labels to select streams. Confirm the exact configuration keys and their behavior for your Loki version in the official retention documentation before you rely on them for audit evidence.

How DeployOpen works on this

DeployOpen plans the move of CloudWatch Logs into self-hosted Loki as a written scope, covering which log groups stream out, how Firehose delivers them to Grafana Alloy, and what stays in CloudWatch. We build and test the pipeline in your AWS account and your Loki environment, then hand over documentation and the configuration your team operates.

How we scope

  • Inventory the log groups, accounts and regions that should stream to Loki, and record which ones stay in CloudWatch.
  • Agree the label set for log group and account, and confirm the Loki tenant and retention rules each stream will use.
  • Confirm the Firehose delivery path, the network route to the Alloy endpoint, and the authentication in front of it.

How we build

  • Configure the Amazon Data Firehose delivery stream and the Grafana Alloy loki.source.awsfirehose receiver in your infrastructure.
  • Route entries through Alloy to your self-hosted Loki and check that labels and tenant IDs arrive as specified.
  • Test failure handling, duplicate detection and query results against sample log groups before any production cutover.

How we hand over

  • Deliver the Alloy and Firehose configuration, IAM policy notes and a runbook for changing log group subscriptions.
  • Document the label scheme, the CloudWatch retention you keep and the Loki retention applied to the streamed data.
  • Walk your platform and security teams through operating the pipeline and reviewing its logs and costs.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Ask for a written quote tied to the agreed scope, and confirm which items are one-time work and which recur.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.