Fixing Loki rate_limited and per_stream_rate_limit errors

Loki rejects pushes when a tenant or a single stream exceeds its ingestion limits. This page shows how to read the discarded-sample metrics, choose between raising limits, splitting hot streams and rate limiting at the agent, and confirm each change.

On this page

Why Loki rejects pushes with rate_limited and how to read the errors first

When logs go missing or agents keep retrying pushes that Loki turns away with rate limit errors, you need to know which limit fired before you change anything. This page covers how to tell apart the three ingestion rejections, rate_limited, per_stream_rate_limit and stream_limit, and how to fix each one without loosening protections you did not mean to loosen. The first step is always to read the discard counters, because the three reasons call for different fixes.

Loki exposes loki_discarded_samples_total and loki_discarded_bytes_total, each with a reason label, and these two counters show which limit is rejecting data. A rate_limited reason means the tenant as a whole exceeded its ingestion rate. A per_stream_rate_limit reason means one stream, a single set of label values, exceeded its own rate, which usually points to a noisy workload or a labeling mistake. A stream_limit reason means a tenant has more active streams than it is allowed. Group the counters by tenant and reason over the last hour, then check which reason rises when the errors appear. The official troubleshooting guide for ingestion (Loki ingestion troubleshooting) walks through this sequence.

Teams need this work when a production shipper reports push failures, dashboards show gaps, or a tenant's log volume jumps after a deployment. It is not the cause when the counters are flat and logs are missing for another reason, such as an agent that never reads its files, a network path that drops connections, or timestamps that fall outside the accepted window. Confirm the discard counters are rising for the affected tenant before you raise any limit. Also confirm which Loki version and configuration you run, because limit defaults and metric names depend on your release, and check the Loki rate limits documentation for the settings that apply to your deployment.

How a push moves through Loki's ingestion limits

The diagram starts at the agent, where stage.limit in Alloy can shape a noisy stream before it reaches Loki. The push then passes the tenant-level rate limit, the per-stream rate limit and the active stream limit, and only then lands in accepted storage. Each rejection point increments loki_discarded_samples_total with a reason label, so check that counter first to see which limit fired.

Where each limit sits in the push path and where discards are counted.

Which fix fits each rejection reason

The rate_limited reason means a tenant pushed more data than its configured ingestion rate allows. The limit applies to the whole tenant, so many streams contribute to the same budget. Growth in the number of applications, a new noisy service, or a logging change that multiplies lines per request usually causes it. Start by reading loki_discarded_samples_total and loki_discarded_bytes_total filtered by the reason label to confirm which tenant is affected and whether the rejections are sustained or a short spike.

  • Confirm the tenant: Check the tenant label on the discarded metrics to see which tenant is hitting its budget.
  • Find the source of growth: Compare ingestion volume by application or namespace over the same period to identify the new or louder producer.
  • Raise the tenant limit deliberately: Increase the ingestion rate and burst size for that tenant only if the volume is expected and the cluster has capacity.
  • Fix noisy logging first: Reduce debug output, duplicate lines, or verbose stack traces at the source when the volume is not useful.
  • Confirm names and values: Check the exact limit keys and defaults for your Loki version in the Loki rate limits docs before editing configuration.

Check whether the rejections match a known volume increase, and confirm the new ceiling against your ingester capacity before raising it.

Configuration options and when each one fits

This table compares the four levers for rate_limited, per_stream_rate_limit and stream_limit rejections: tenant limits, per-stream limits, rate limiting at the agent, and splitting streams. Read each row against the rejection reason you see in the discarded sample metrics, because raising a limit only helps when the cluster has headroom to absorb the extra data. The main takeaway is that limits protect the cluster, so change them after you know which stream or tenant is producing the excess.

LeverWhere it livesWhat it protectsMain riskWhen it fits
Tenant ingestion rate and burst limitsLoki runtime and global limits configuration for the tenant (confirm key names in the request validation and rate limits page)Cluster ingesters and distributors from one tenant overwhelming shared capacityHigher ingestion can raise memory, disk and query cost for every tenant on the clusterA tenant's total volume legitimately grew and the cluster has measured headroom
Per-stream rate limitsPer-tenant limits configuration, applied to each individual stream (confirm key names in the rate limits page)A single hot stream from consuming the ingestion budget of its tenantRaising it lets one noisy source grow unchecked and can hide a logging bugOne stream is valid but chatty, such as a busy service with a known, bounded log rate
Alloy stage.limit block at the agentGrafana Alloy pipeline configuration on the host or pod that ships the logsLoki from receiving bursts from one source, and the cluster from excess loadLines dropped at the agent are lost unless you have a plan for them and monitor the dropA noisy source emits more than it needs to, such as debug output or a retry loop
Splitting streams by changing labelsLabels set by the agent or pipeline that defines the stream identityPer-stream limits by spreading volume across more streamsNew label values raise cardinality, which can cost more than the rate limit it avoidsA stream's volume is high because it mixes sources that a label could separate cleanly
Sharding a streamStream sharding settings on the tenant, combined with labels in the agentThroughput of a single hot stream without changing its label setSharding adds ingestion overhead and changes how queries fan out across shardsThe stream is hot but its labels are already correct and cardinality must stay low
Reducing volume before ingestionAgent filtering or sampling rules, or the application's log levelCost and limits together by removing lines nobody queriesRemoved lines cannot be recovered for later investigationMost of the excess is repetitive, low-value output

How to work through a rate limit incident

This sequence takes an operator from a push rejection alert to a verified fix, so each change is tied to a named tenant, stream and limit rather than a guess.

  1. Confirm the rejection reason from metrics

    Start in Grafana or Prometheus and query loki_discarded_samples_total and loki_discarded_bytes_total, grouped by the reason label. Confirm whether the rejections are rate_limited, per_stream_rate_limit or stream_limit, since each points to a different lever. Ignore reasons unrelated to rate limits for now. The step is done when you can state the dominant reason and the time window in which it started.

  2. Identify the tenant and hot stream

    Break the discarded-sample series down by tenant and by the labels the error names, then compare against the stream labels in the logs you are trying to push. Confirm the tenant with the X-Scope-OrgID header used by the sending agent. Look for one label set, such as a single container or host, that accounts for most of the volume. The step is done when you have a tenant ID and a stream selector written down, and you know whether the pressure sits on one stream or many.

  3. Check whether the spike is steady or a burst

    Plot the ingest rate for the affected tenant and stream over a longer window, such as several days, and compare it with a short window around the rejections. A steady climb suggests the tenant or stream has outgrown its configured limit. A short spike suggests a deploy, a crash loop or a logging bug. Confirm the cause with the team that owns the workload before changing any limit. The step is done when you have labeled the pattern as steady, burst or both.

  4. Choose the lever

    Match the pattern to a fix. For a steady, legitimate increase, plan a tenant limit change. For a single chatty stream, plan to split it into smaller streams with different labels or to limit its rate at the agent using Alloy's stage.limit block. For a bug in the workload, fix the source and leave the limits alone. Record the lever, the value you intend to change and the expected effect. The step is done when the change request names one lever and one tenant or stream, so it can be reverted cleanly.

  5. Apply the change in a low-risk tenant first

    Apply the chosen change in a staging environment or a low-risk tenant before production. Mirror the agent configuration, the tenant limit and the stream labels you plan to use. Confirm the new settings are loaded by checking the running configuration on the Loki components, not only the file on disk. The step is done when the staging run shows the expected stream labels and limits without new rejections from the same source.

  6. Roll the change into production

    Apply the same change to the production tenant or agent in a controlled window agreed with the owning team. Keep the previous configuration available so you can roll back quickly. Watch the rejection metrics and the agent's own error logs during the rollout. The step is done when the change is live and both the rejection rate and the agent queue behave as expected for the period you monitored.

  7. Verify discarded samples fall and no data loss appears

    Confirm that loki_discarded_samples_total and loki_discarded_bytes_total for the target reason flatten or drop after the change. Then check for data loss: run a query for the expected log lines from the affected stream across the period, and compare counts with the source system where you can. If you run Loki Canary, confirm its results remain clean. The step is done when the discard counters have stopped growing for the target reason and you have evidence that the affected logs are present in Loki.

When to rate limit at the agent instead of raising Loki limits

Rate limiting at the agent is the right move when one source is flooding Loki and the cluster-wide tenant limits are already set for the workload you want to keep. In Grafana Alloy, the stage.limit block shapes the rate of log lines for a stream before they reach Loki, so a per_stream_rate_limit rejection on one noisy application can be contained without loosening limits for every other tenant. The benefit is isolation: one source cannot starve others sharing the same tenant or the same ingesters. The cost is that lines are delayed or dropped at the source, and those lines never reach Loki. Before you add the block, confirm with the team that owns the application which lines can be dropped or delayed, and get that agreement in writing, because the loss will be invisible to the people querying Loki later.

Splitting a stream into smaller streams is usually the better long-term fix when the rejections come from a stream that is simply too large by design. Loki limits pushes per stream, and each unique combination of label values creates a separate stream, so a label such as a request ID, user ID or pod name that changes constantly multiplies the stream count and spreads one service's volume across many fragments. Review the labels attached to the hot stream and move high-variation values into structured metadata or the log line itself where that suits your queries. If the volume is legitimately high and the labels are already sensible, a single agent-side limit will only hide the problem. Check the stream count and the labels on the offending source with a LogQL query before deciding.

Treat any agent-side limit as a temporary control with a review date and an owner. Record which stream it applies to, the rate it enforces, and the metric you will watch, which is loki_discarded_samples_total filtered by the reason label, to confirm that rejections fall and that the dropped volume is acceptable. Confirm the exact stage.limit syntax and options against the Alloy version you run, because configuration details change between releases. If the same stream keeps needing limits after you have reviewed its labels and its volume, that is the signal to plan a stream redesign with the application team rather than tuning the agent further.

Security and operational risks when changing ingestion limits

Raising a Loki limit is a change to shared capacity, and the same edit can hide a fault, drop evidence or open a path around tenant isolation. The cards below cover the risks to review before and after any change to rate limits, and what to check in each case.

Shared ingesters absorb the extra load

Tenants on a shared cluster write to the same ingesters, so raising one tenant's ingestion_rate_mb or burst size lets that tenant consume capacity the others depend on. Before the change, review ingester CPU, memory and WAL disk headroom and the write path under the new peak. Ask who else writes to the cluster and whether they will see slower pushes during a spike.

Limits that hide a faulty agent

A per_stream_rate_limit error often means one agent is sending far more lines than expected, perhaps from a crash loop, a debug flag left on or a repeated log message. Raising the limit makes the rejections stop while the noisy source keeps running and keeps costing storage and query time. Identify the source of the excess volume first, then decide whether the limit or the agent should change.

Dropped logs that matter for audit

Samples rejected by a rate limit are discarded at the push, so they never reach storage, and a gap may not be visible until someone searches for a specific event. If the affected streams hold authentication, access or change records, the gap can break an audit trail. Map which streams carry audit data, confirm their retention and agree with the compliance owner how discarded data will be recorded.

Proxy and tenant header changes

Loki identifies tenants with the X-Scope-OrgID header, and the authenticating reverse proxy in front of it decides which tenant a request carries. A change to proxy routing, header rewriting or tenant mapping can send one team's logs under another tenant's limits or quota. Test each tenant's push path after any proxy change and confirm that clients cannot set the header themselves.

Loki multi-tenancy docs

Monitoring discarded metrics after each change

A limit change is only verified when the discard counters show the expected result. Watch loki_discarded_samples_total and loki_discarded_bytes_total by reason for each tenant and compare them with the values from before the change. A rate that falls to zero for one tenant while another rises may mean the change moved the problem rather than fixed it. Record the baseline and set an alert on any new discard reason.

Questions teams ask before fixing Loki rate limit errors

How long does a fix for Loki rate limit errors usually take?

No supplied figure gives a duration, so the honest answer depends on the drivers: how many tenants and agents push to the cluster, how many streams are hot, and whether the fix is a limit change, a label change or an agent change. A limit change on one tenant is quick to make but needs observation afterward. Splitting a hot stream means changing agent configuration and checking that queries still return what dashboards expect, which takes longer. Ask any partner to base its estimate on a written inventory of affected tenants and streams, and confirm the change window your environment needs.

Can our own team fix Loki rate limit errors without outside help?

Often yes, if the team can read discarded sample metrics, has access to the Loki configuration and owns the agents that push logs. The Loki ingestion troubleshooting guide covers the rate_limited, per_stream_rate_limit and stream_limit reasons and the metrics that track them, so the diagnosis is documented. The harder parts are usually organizational: knowing which application team owns a noisy stream, and changing its logging behavior or agent pipeline. Teams without a Loki operator, or with no one who owns each log source, tend to need help with ownership and change coordination more than with the settings themselves.

What do we need to provide before a Loki rate limit fix starts?

Plan to provide four things. First, read access to the Loki metrics that record discarded samples and bytes, broken down by the reason label, so the fix is based on evidence. Second, the names of the owners for each log source or agent that pushes to the affected tenants. Third, access to the agent configuration, such as Grafana Alloy pipelines, and to the Loki limits configuration. Fourth, agreed change windows, because raising or lowering limits and changing agent pipelines both affect live ingestion. Ask for a written list of these inputs as part of the scope.

Is it safe to raise Loki tenant limits to stop rejected pushes?

Raising limits can stop rejections quickly, but it moves the cost to the cluster. Higher ingestion rates need more write capacity, more memory in ingesters and more storage, and a single noisy stream can still overload one part of the system even when the tenant total is allowed. A safer sequence is to identify the stream or agent producing the excess, decide whether the volume is expected, then set limits that match the capacity you have measured. Check the write path and object storage after each change and keep the previous values so you can roll back.

What does a Loki rate limit fix cost, and what drives the price?

DeployOpen does not publish prices, and no researched cost figure is available for this work. The cost has two parts: the time your staff spend on diagnosis, agent changes and cluster observation, and any outside fee for a fixed-scope engagement. The main drivers are the number of tenants and log sources involved, how many streams need splitting or rate limiting at the agent, how much change control your organization requires, and whether the cluster needs capacity work afterward. Ask for a quote built from a written scope that lists these items, and ask whether ongoing monitoring is included or sold as a separate retainer.

When should we bring in outside help for Loki rate limit errors?

Consider outside help when rejections recur after limit changes, when many teams and agents push to one cluster, or when the fix needs changes that cross organizational boundaries. It also makes sense when your team lacks someone who can run the Loki metrics and agent configuration in production, or when a change must be reviewed before a regulated environment accepts it. DeployOpen plans, implements and documents Loki work inside your own infrastructure as fixed-scope engagements, and offers retainers for ongoing support. Ask for the scope in writing before work starts, including what is handed over to your team.

Should we rate limit at the agent or split the stream in Loki?

Both are valid fixes, and the choice depends on where the excess comes from. Rate limiting at the agent with the stage.limit block in Grafana Alloy caps how fast one stream is sent, which protects the cluster without changing the application. Splitting a hot stream into smaller streams spreads the volume across more label sets, which suits streams that are legitimately large. Limiting at the agent can drop lines the team needs, so confirm with the stream owner which lines matter before applying it. Test the chosen approach on one source first.

Who should own the fix in a shared Loki cluster

Platform operators should own the cluster-wide limits, and application or infrastructure teams should own the streams their agents produce. A rate_limited or per_stream_rate_limit rejection looks like a single failure, but the fix can sit in three places: the tenant limits the platform team sets, the agent configuration and label choices the producing team controls, or the volume of logs the business is willing to keep. Assigning the work before anyone edits a setting prevents a common pattern where the platform team raises limits to stop alerts while the noisy stream keeps growing. The platform team should confirm which tenant limits it manages centrally and which ones each tenant can request changes to.

Application and infrastructure teams should decide how their agents shape traffic. Splitting a hot stream, changing labels so each stream stays within its rate, or adding a rate limit at the agent with the stage.limit block in Grafana Alloy all change what the producing service sends, so those teams need to review and deploy them. Ask each team to show the discarded sample metrics for its own tenant and to name the stream whose volume it expects to change. Where a team cannot yet say why a stream is hot, the agent change should wait until the stream's contents are understood, because a limit applied blindly can drop the lines an incident responder needs most.

Security or compliance owners must agree before any log is dropped on purpose. Limiting a stream at the agent or refusing pushes at the cluster means some events will not be stored, and that can conflict with the audit logging and retention commitments the organization has made. Involve these owners early, record which streams may be sampled or truncated, and confirm that dropped volume is still visible in the discarded sample counters. Use this decision guide: platform operators approve tenant limit increases and cluster capacity changes; the owning team approves agent rate limits, label changes and stream splits; security or compliance approves any reduction in retained or ingested log coverage.

How DeployOpen works on this

DeployOpen approaches Loki rate_limited and per_stream_rate_limit errors as a fixed-scope piece of work inside your own infrastructure. We start from the discarded sample metrics your cluster already emits, agree on the limit and stream changes in writing, and then deliver them with documentation and ongoing support available as a retainer.

How we scope

  • We review which tenants and streams hit rate_limited, per_stream_rate_limit or stream_limit, using your discarded sample and bytes metrics.
  • The written scope names the tenants, limits, agent configurations and stream layouts in change, and what stays out of scope.
  • We confirm your Loki deployment mode, agent fleet and who in your team approves limit changes before any work starts.

How we build

  • We adjust per-tenant ingestion limits in your Loki configuration, one change set at a time, with the reason recorded for each value.
  • Where a stream is too hot, we design the split into smaller streams or a rate limit at the agent using Alloy's stage.limit block.
  • We test each change against representative push traffic in a non-production environment before it reaches the production cluster.

How we hand over

  • You receive the final configuration, agent pipeline changes and a runbook describing which metric to watch and what each reason label means.
  • We document the expected discarded sample behavior after the change, so your on-call team can tell a healthy cluster from a regression.
  • Knowledge transfer sessions cover the limit model, so your engineers can adjust limits later without re-opening the engagement.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, covering limit reviews as tenants and volumes grow.
  • We can re-check discarded sample metrics after new sources or Loki upgrades, and report what changed.
  • Any follow-up change is scoped in writing before work starts, so you know what is covered and what it costs before it is done.

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.