Why Loki rejects old and out-of-order samples and what to do first
Your shippers report errors while logs for the last few hours never appear in Grafana. The usual cause is that Loki is refusing samples that fall outside its acceptance window, and the rejection reason in the push response or the discarded samples metric tells you which rule fired. Loki enforces reject_old_samples, which is true by default, and rejects samples older than reject_old_samples_max_age with the reason greater_than_max_sample_age. Two other validation errors look similar but have different causes: too_far_behind relates to how far a stream's newest entry trails the stream's own ordering, and too_far_in_future means an entry's timestamp is ahead of the cluster's clock. Read the exact reason before you touch any setting, because raising the age limit will not fix a clock problem and correcting clocks will not fix a replayed backlog.
Teams usually need this page in three situations: after a shipper or network outage where agents buffered logs and sent them late, after a clock problem on hosts or in the write path, or after a migration or import that replays historical logs into a live cluster. Each situation points to a different first action. A shipper outage often needs no Loki change at all, only a check that the agent's buffer drains within the age window. Clock skew needs the host time sources fixed and verified. A deliberate backfill needs a decision about whether the limit should be raised for one tenant for a bounded period, and whether the data belongs in a separate tenant or environment. Confirm the limit values, the tenant configuration and the timestamps your shippers send in your own environment, since these depend on your deployment.
This is a diagnosis-first topic, and the fix depends on the cause. Start by identifying which reason appears, which tenants and streams are affected, and the time range of the rejected entries compared with the time range of the cluster's clock and the shipper's clock. Only after that choice is clear should you decide between correcting the source, changing a tenant limit or planning a controlled backfill. Raising limits without knowing the cause hides the problem, lets stale data arrive unchecked and can make the cluster harder to size. The Loki troubleshoot ingestion guide covers the error messages, and the Loki rate limits and request validation reference explains the settings that control each check.
Reading too_far_behind, greater_than_max_sample_age and too_far_in_future
Loki's ingestion rejections for old and future timestamps usually come from one of four places: the shipping pipeline, the clock on a host, a replayed backlog, or the reject window itself. The cards below pair each rejection reason with its likely source and the first check to run. Confirm exact reason strings and metric names against the troubleshoot ingestion guide for your Loki version before you write alert rules.
Delayed shipper queue
A shipper that buffers logs during a network outage or a destination slowdown can deliver lines minutes or hours after they were written. Loki then compares each sample's timestamp with its ingestion time and rejects those that fall outside the allowed window. The symptom usually appears as a rejection spike that follows a known outage on the shipping path. First check the shipper's retry and buffer metrics, then compare the timestamps of rejected lines with the time the shipper reported recovery. Confirm the exact reason string for this case in the troubleshoot ingestion guide.
Troubleshoot ingestionHost clock running behind
When a host's clock lags real time, its freshly written logs carry timestamps that look old by the time they reach Loki. Rejections then cluster on a single host or node pool rather than across the fleet. This is a common cause of greater_than_max_sample_age on hosts that were recently rebuilt or moved between hypervisors. First check time synchronization status on the affected host and compare its clock with a trusted time source. Fix the clock before adjusting any Loki limit.
Host clock running ahead
A clock set ahead of real time writes timestamps in the future, and Loki rejects those samples as too far in the future. Rejections of this kind often show up right after a VM restore, a hypervisor migration, or a container node that was provisioned with a wrong time zone or NTP source. Check whether rejected lines carry timestamps later than the ingestion time, then identify which source host or container runtime stamped them. Correct the source clock rather than widening future-time tolerance.
Replayed historical backlog
Backfilling logs from archives, a retired collector, or a disaster recovery copy pushes samples that are far older than the reject window. Loki drops them unless the window allows them, so a backfill that appears to succeed can lose most of its content. The likely source is a one-time import job rather than a steady pipeline. Before the replay, estimate the oldest timestamp in the source files, decide whether that data belongs in this cluster, and plan a controlled import window.
Misconfigured reject window
With reject_old_samples enabled by default, Loki applies the reject_old_samples_max_age limit globally or per tenant. A window set too short for real shipping delays will reject valid recent logs, while a tenant-level override left from testing can hide the problem for one team only. First check the effective limits for the affected tenant, then confirm whether the override matches the shipping latency you measured. Changes to these limits should be documented and reviewed like any other production setting.
Rate limits docsWhich Loki limit or setting fits each rejection pattern
This table compares the settings and agent-side options you can change when Loki rejects old, late or future-dated samples. Read each row by first identifying the rejection reason in the logs, then checking whether the fix belongs in the shipper, in the tenant limits or in the data itself. The main takeaway is that raising the age limit is the widest change, so it should follow a check that the delay is expected.
| Setting or option | When it fits | Trade-off and risk |
|---|---|---|
| reject_old_samples (left at true) | Live systems where old timestamps usually signal a stuck or misconfigured shipper | Keeps stale data out of the cluster, but backfills and delayed shippers will be rejected until the limit or the data path changes |
| reject_old_samples set to false | Short, deliberate backfill windows you have planned and can monitor | Accepts samples of any age, which raises ingester and compactor load and widens the window for stale data; disable it again after the backfill |
| reject_old_samples_max_age, global | Most clusters where a known, bounded shipping delay exceeds the default age | Applies to every tenant, so a higher value can hide delays in unrelated teams; confirm the current value in your version's limits reference |
| reject_old_samples_max_age, per tenant | One team or customer that ships batched or delayed logs while others stay strict | Keeps the change contained, but each override needs an owner and a review date so it does not become permanent |
| Shipper buffering and retry settings (Alloy, Fluent Bit, Fluentd) | Delayed shippers that queue logs during network or destination outages | Fixes the cause instead of the symptom, but large buffers increase local disk use and can lose data if the agent restarts without persistent storage |
| Shipper timestamp handling | Hosts or containers whose clocks lag or run ahead, producing too_far_behind or too_far_in_future | Corrects the source, but misparsed timestamps can silently shift entries into the wrong time window; test with sample lines first |
| Host clock synchronization (NTP) | Clock skew across nodes that causes too_far_in_future rejections | Solves the root cause for all senders, but it is an infrastructure change that needs coordination with platform owners |
| Backfill with a separate tenant or time-windowed pushes | Importing historical logs without loosening limits for live traffic | Isolates the load and keeps live limits strict, but needs extra tenant setup and a plan for querying the imported data |
Diagnosing and fixing a rejection in a production cluster
This sequence identifies which validation rule is rejecting samples, separates shipper delay and clock error from genuine need for a higher age limit, and confirms the fix with a controlled test push. Each step ends with a check so the team knows whether to continue or roll back.
Confirm the rejection reason from metrics and logs
Start by identifying which reason is firing: greater_than_max_sample_age, too_far_behind or too_far_in_future. Check the discarded-samples metrics for the affected tenant and the distributor or ingester logs for the matching validation message, and note the stream labels and time window involved. The step is complete when you can name one reason and the tenant, namespace or host it affects. Do not change any setting yet, because each reason points to a different cause and fix. Rollback: none needed, since this step only reads data.
Measure shipper lag for affected sources
Compare the timestamps on the log lines the agent sends with the time they were written at the source, and check the agent's own queue and retry state. Look for buffers that were held during a network outage, a shipper restart that replayed old files, or a pipeline that has fallen behind a busy host. The step is complete when you know the typical lag and whether it is steady, growing or a one-time backlog. Rollback: none needed. Record the findings so you can compare them after the fix.
Measure host clock offset against a reference
Check each affected host's clock against your time source using the time synchronization tool your operating system provides, such as chrony or systemd-timesyncd. A sample that appears too far in the future usually points to a host clock running ahead, while a sample rejected as too old can come from a clock running behind or from delayed delivery. The step is complete when every affected host shows an offset you can explain, or when you have identified hosts that need correction. Rollback: none needed, since this step only observes.
Review the tenant's current limits
Read the effective ingestion limits for the affected tenant, including reject_old_samples, reject_old_samples_max_age and any per-tenant overrides, and compare them with the global defaults in the Loki configuration. Confirm whether the override was set deliberately and by whom, using your change records. The step is complete when you know the current values and where they are defined. Ask your platform team to confirm this against your own configuration files, since overrides can be set in more than one place. Rollback: none needed.
Correct the shipper or clock before changing limits
If Steps 2 and 3 show a shipper backlog or clock drift, fix that first: correct the time synchronization on the host, adjust the agent's buffering or replay behavior, or pause the backfill job. Changing limits to hide a clock or pipeline fault leaves the root cause in place and widens what the cluster accepts. The step is complete when the offset is within your tolerance and new lines arrive with timestamps close to their source time. Rollback: revert the agent or time service change using your normal configuration management history, and confirm the previous behavior returns.
Raise reject_old_samples_max_age per tenant if justified
Only when the data is legitimately old, such as a planned backfill of historical logs or a source that is known to deliver with long delays, raise reject_old_samples_max_age for that tenant rather than globally. Document the reason, the new value and the date the override should be reviewed, and remove it once the backfill ends. The step is complete when the change is deployed through your configuration process and the override is visible in the tenant's effective limits. Rollback: restore the previous value in the same configuration file and reapply it, keeping the change record linked to the rollback.
Verify with a test push and a query
Send a small, labeled test entry from the affected source with a timestamp inside the newly allowed window, using the tenant's X-Scope-OrgID header. Then query for that label set in Grafana or with a LogQL query and confirm the line is stored, and check that the discarded-samples metric for the reason has stopped increasing. The step is complete when the test line is queryable and the rejection rate has dropped for the affected source. Rollback: if the test fails or rejections continue, return the limit to its previous value and reopen the shipper or clock findings from Steps 2 and 3.
How to backfill historical logs without fighting the acceptance window
Choose the backfill route before you touch any limits, because each option changes what the cluster accepts, how it orders data and what queries will show afterward. The three realistic routes are: raise reject_old_samples_max_age for one specific tenant and a bounded time window, replay the history through a controlled pipeline that writes at a deliberate pace, or load the history into a separate tenant or a separate cluster. Raising the limit is the fastest path and the easiest to forget, so it suits a one-time, small and well-understood gap. Replaying through a pipeline suits large historical sets that must land in production tenants. A separate tenant or cluster suits archives you want isolated from live data, and it keeps retention and access decisions simple. Confirm the exact limit names and their scope (global or per tenant) for your Loki version in the Loki rate limits and push request validation docs before you change anything.
Ordering is the concern most teams underestimate. Historical entries pushed into a stream that already holds newer entries will hit the same out-of-order handling you were trying to fix, so backfill into streams that have no live data in the same window, or into a tenant that is not receiving current traffic. Retention is the second concern: Loki applies retention from the compactor, and the retention settings for a backfilled tenant decide how long old data survives. If you backfill two years of logs into a tenant with a short retention period, the oldest entries may be deleted soon after they arrive. Check the retention rules for the target tenant before the load, and remember that retention is disabled by default, so an unconfigured tenant keeps everything indefinitely.
Throttle the load and verify it as it runs. Push historical data in bounded batches, watch ingestion and discarded-sample metrics for the target tenant, and pause if rejections or rate limits rise, since a backfill can crowd out live traffic on the same write path. Verify the result with queries that count entries per stream and per day against the source system, and spot-check known events. Also confirm that the time ranges you query return the expected volume, because queries over the backfilled window will now include data that did not exist when live dashboards were built. Restore the original limit values once the load completes, and record the tenant, window, limit change and verification results so the change can be audited later. Ask your implementation partner or internal team to write this runbook before the first batch is sent.
How a pushed sample passes or fails Loki's time checks
A push from a shipper such as Grafana Alloy enters Loki and is checked against the clock first. A timestamp too far in the future is rejected as too_far_in_future. Next, a sample older than the accepted window is handled by the reject_old_samples setting: when it is on, which is the default, the sample is rejected with greater_than_max_sample_age, and when it is off, the sample is not rejected on age. Samples that pass both checks move into ingestion, while rejected samples are counted under their reason. Check the reason counter first when a shipper's backlog goes missing.
Time checks Loki applies to each pushed sample before ingestion.
Security and operational risks of loosening the time window
Raising the sample age limit or accepting future timestamps changes who can write what into a tenant and when that data becomes visible. The four cards below cover the security exposure, the operational side effects on other shippers, and the data loss that can happen quietly at the agent.
Stale and replayed data enters tenants
A wider reject_old_samples_max_age lets any client that can push to a tenant write entries that are days or weeks old. Those entries can be replayed captures, duplicated batches or logs from a decommissioned system, and they land in the same query results as live data. Before raising the limit, confirm which credentials can push to each tenant, check whether a replayed batch could still pass validation, and decide whether the window should be widened for one tenant or for the whole cluster.
Rate limits docsWrong tenant header mixes data
Loki identifies tenants only by the X-Scope-OrgID header, and a backfill job that sets the wrong value writes historical logs into another team's tenant. Loki has no built-in authentication layer, so the backfill endpoint must sit behind an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium that maps each identity to an allowed tenant. Test the mapping with one known record before running the full import.
Multi-tenancy docsRaised limits affect every shipper
A per-tenant increase to the sample age limit applies to every agent and pipeline writing to that tenant, not only the backfill job. Live shippers that are healthy will also gain the wider window, so a misconfigured source can push old data without anyone noticing. Record the limit change, the owner and the date, and set a reminder to lower it once the backfill finishes so the relaxed window does not become permanent.
Rejected data lost at the agent
When Loki rejects a sample, the agent may drop it after logging a warning, and the rejection can be missed if nobody watches the discarded-sample metrics. The result is silent gaps that look like healthy ingestion on the dashboard. Confirm how your agent handles HTTP 400 responses from Loki, whether it retries or discards, and alert on rejection counts by reason so a rejected backfill is visible while it runs.
Troubleshoot ingestionQuestions teams ask before fixing Loki sample rejections
How much effort does diagnosing out-of-order and old sample rejections take?
The effort depends mostly on how many shippers feed the cluster, how many tenants share it, and whether the rejected samples come from one source or many. A single host with a stuck agent is usually a short investigation. A cluster with dozens of shippers across several tenants needs each rejection reason matched to a source, a timestamp pattern and a tenant before any setting changes. Ask any provider to scope the work by listing the shippers, tenants and environments in writing, then agree which evidence (metrics, agent logs, host clock data) will be reviewed.
Can our own team diagnose these rejections without outside help?
Yes, if the team can read Loki's ingestion metrics, check agent buffering and confirm host time synchronization. The official ingestion troubleshooting guide covers too_far_behind, greater_than_max_sample_age and too_far_in_future, so an engineer with cluster access can work through the likely causes. Outside help tends to pay off when several shippers and tenants are involved, when the fix needs changes to per-tenant limits across the cluster, or when backfilling must run without disturbing live ingestion. Decide early which parts your team owns and which need a second pair of eyes.
What access does a consultant need to diagnose sample rejections?
A consultant typically needs read access to Loki's configuration, the relevant tenant limit settings, and the metrics that record rejections by reason and tenant. They also need to see the shipper configuration (Grafana Alloy, Fluent Bit or other clients), the hosts that run them, and time synchronization status on those hosts. Write access should be limited to a change window and a named owner. Grant access through your existing identity and secrets controls, and agree in advance on logging of any changes made during the engagement.
How long does a backfill of historical logs take, and what controls its duration?
Backfill duration depends on the volume of historical data, the rate at which your cluster can accept pushes without affecting live traffic, and the limits in place for each tenant. Historical samples older than the configured maximum age are rejected unless that limit is raised, so the backfill window and the limit must be planned together. Ask for a written plan that states the time range, the source files or systems, the throttle applied, and how live ingestion is protected. Your vendor should also tell you how the backfill is verified against the source data.
Is raising reject_old_samples_max_age safe?
Raising the limit is safe only when you know which streams need older samples and why. Loki rejects samples older than reject_old_samples_max_age when reject_old_samples is true, which is the default, and the limit can be raised globally or per tenant. A global increase widens the window for every shipper, including ones with real delay problems that should be fixed at the source. Prefer a per-tenant change with a documented reason, a planned end date and a check that the extra data lands in the expected streams.
What changes if we later move from Promtail to Grafana Alloy?
Promtail reached end of life on March 2, 2026, and Grafana directs users to migrate to Grafana Alloy, so the shipper change is likely to happen at some point. The rejection causes stay the same: a delayed agent, a skewed host clock or a stale buffer will still produce late samples after the switch. What changes is where you check the agent, its buffering and its timestamp handling. Plan the migration so you do not change the shipper and the limits in the same window, and confirm the Alloy configuration with your own tests.
How do we know whether a rejection comes from clock skew or a slow shipper?
Compare the timestamp of the rejected sample with the time Loki received it and with the host clock. A consistent offset across all lines from one host points to clock skew, while a growing lag that appears only after backlogs or network interruptions points to a slow or stalled shipper. The too_far_in_future error usually means the sample timestamp is ahead of Loki's clock, which is a clock problem on the sender or receiver. Confirm time synchronization with your platform team before changing any Loki setting.
Will the rejection problem come back after we fix it?
It can, unless the cause is removed at the source. Shippers that buffer during outages will send late samples again after the next network or host incident, and a clock drift can return after a reboot or a configuration change. Ask for alerts on rejection counts by reason and tenant, a documented runbook for each reason, and a review after the first few weeks of normal traffic. Make sure the agreed handover states who watches these alerts after the engagement ends.
How DeployOpen scopes and delivers Loki ingestion fixes
DeployOpen works on out-of-order and old sample rejections as a fixed-scope engagement inside your own infrastructure. We start from your shipper inventory, clock sources and current tenant limits, then agree in writing what gets changed, tested and handed over before any production setting moves.
How we scope
- Inventory every shipper, agent and pipeline that pushes to your Loki cluster, with its clock source and buffering behavior
- Pull rejection counts by reason and tenant to confirm which of the three validation errors you are seeing
- Agree in writing whether the fix is shipper configuration, clock correction, tenant limit changes or a backfill job
How we build
- Adjust agent buffering, batching and timestamp handling in Grafana Alloy or your chosen shipper, with change records
- Set reject_old_samples and reject_old_samples_max_age globally or per tenant only where the agreed scope requires it
- Test backfill of historical logs in a staging tenant first, checking stream labels and retention before the production run
How we hand over
- Deliver a written runbook covering the rejection reasons, dashboards to watch and the settings that were changed and why
- Walk your platform and SRE team through the diagnosis steps so they can repeat them without DeployOpen
- Document open items, such as clock drift on hosts outside our scope, with named owners on your side
How we support
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts
- Ongoing support, upgrades and continuous testing are available as a retainer after handover
- Ask any quote to state which shipper versions, tenant counts and clock sources it assumes

