The Loki write-ahead log: durability and disk sizing

The Loki write-ahead log keeps acknowledged data on local disk so an ingester can replay it after a crash. This page explains the replay behavior, the recovery trade-offs, alerting on corruption and how to size the WAL volume.

On this page

What the Loki write-ahead log protects and when it matters

If you have promised a team or an auditor that logs are kept for a set period, the question that matters is what happens to logs that Loki has already accepted when an ingester crashes. The write-ahead log (WAL) answers that question. Loki's WAL records incoming data on the local filesystem of each ingester, so data acknowledged to a client survives a process crash. When the ingester restarts, it replays that log before it registers as ready, rebuilding the in-memory state it lost. Without the WAL, the chunks an ingester was still holding in memory would exist nowhere else until they were flushed to object storage.

Plan for the WAL whenever ingesters carry write-path data that someone depends on. That includes production clusters that receive logs from many agents, deployments where ingesters run as stateful workloads with persistent volumes, and any environment where logs are captured to meet a retention or audit commitment. In these setups the ingester's local disk is part of your durability design, not scratch space. Confirm with your own team how your ingesters are scheduled, whether their volumes survive pod or node replacement, and who is responsible for restoring a volume that fails.

The WAL also changes how you think about the rest of the ingester's storage. It is a local component, so its durability depends on the disk, the volume class and the way the ingester is restarted, none of which Loki manages for you. Before you size anything, decide which failures you need to survive, document the recovery expectation for each, and check the Loki write-ahead log documentation for the current settings in the version you run. The sections that follow cover the two cases where the WAL trades durability for availability and how to size the volume.

How writes, the WAL and replay fit together

The diagram starts at the push request from an agent and follows it into the ingester, where the data is recorded in the WAL on local disk before the write is acknowledged. Chunks are flushed later to object storage. After a crash, the ingester replays the WAL before it reports ready. The branch on the right covers a corrupted or partly deleted WAL: Loki recovers what it can and still starts, and loki_ingester_wal_corruptions_total is the metric to watch for that case.

Write acknowledgement, flush and replay path for a Loki ingester with a WAL.

How an ingester replays acknowledged data after a crash

Before you size anything for the Loki write-ahead log, you need the sequence it follows. Each write an ingester receives is recorded in the WAL on the local filesystem, so data the ingester has acknowledged survives a process crash. When the ingester restarts, it replays the WAL before it registers as ready. In other words, acknowledged data is recovered rather than lost, and the ingester does not accept traffic as ready until that replay has finished. The sequence is what drives both your restart expectations and your disk plan.

Replay happens before readiness, so the time an ingester spends replaying is time it is not serving writes. The amount of WAL to replay grows with how much data the ingester accepted since its last clean state, which means ingest volume and the length of time between cleanups both feed into restart duration. Ask your team to measure replay time on a restart of a representative ingester under your real write rate, and do not assume a figure from a different cluster. Also plan for rolling restarts so that replay on one ingester does not leave too few writers available for the rest of the cluster.

The volume mounted for the WAL must hold everything an ingester may need to replay, along with the space for new writes arriving while it runs. Treat it as persistent storage tied to that ingester, not as scratch space. Confirm the exact on-disk layout, the file naming, the replay internals and the sizing guidance in the Loki write ahead log documentation for the version you run, because these details change between releases. Your sizing test should cover both a normal restart and a restart after an unclean shutdown, since those are the cases that stress the volume.

Which WAL configuration choices fit which environment

This table compares the main choices a team makes around the Loki WAL: persistent local volumes, ephemeral storage, a dedicated disk and spreading ingesters across failure domains. Read each row for what the option protects, what it costs in restart time or disk, and the environments where it fits. The main takeaway is that the WAL only helps if the volume survives the failure you are planning for.

OptionWhat it protectsWhat it costsWhen it fits
Persistent local volume for the WALAcknowledged data across an ingester process crash, because the WAL is replayed before the ingester reports readyDisk space on each ingester sized for the WAL, and replay time added to restartsProduction clusters where a process crash must not lose recently acknowledged logs
Ephemeral storage for the WALNothing beyond the running process; a pod or node loss discards the WAL along with the data it heldLittle extra disk and no volume lifecycle to manage, but recent data exists only in memory and on replicasShort-lived or test environments where losing the most recent data is acceptable
Dedicated fast disk for the WALLower write latency on the ingestion path and separation of WAL I/O from chunk and index work on the same diskAn additional volume to provision, monitor and size per ingesterHigh-ingest clusters where disk contention on shared volumes shows up as ingestion slowdowns
Ingesters spread across failure domainsRecent data still exists on other replicas if one ingester's WAL is lost or corruptedMore ingester instances and replication overhead, so more total disk and memoryClusters with multiple zones or racks where a single host or zone failure must not remove the only copy of recent data
Local WAL on a single ingester with no replicasCrash recovery of that one process only, with no second copy if its volume is lostThe lowest instance count, but a lost volume means loss of the data it heldSingle-binary or small installs where the operator accepts that risk and has a backup plan
WAL corruption recoveryLoki recovers what it can and still starts, so one bad WAL does not necessarily block ingester startupData in the corrupted portion may be lost, so the gap must be detectedEvery production cluster; pair with alerting on loki_ingester_wal_corruptions_total

How WAL disk sizing changes by deployment environment

On Kubernetes, each ingester pod writes its WAL to a persistent volume, so the volume must follow the pod through restarts and rescheduling. Size is set per replica, which means the total WAL footprint is the per-ingester figure multiplied by the number of ingesters. The volume needed depends on the rate of incoming data, the number of active streams, the interval between checkpoints and flushes, and how long replay takes after a crash.

  • Ingest rate per ingester: Measure the bytes per second each ingester receives, since the cluster total hides uneven load across replicas.
  • Stream count: Every active stream adds state, so label cardinality raises WAL and memory use together.
  • Checkpoint and flush cadence: Longer gaps between checkpoints leave more WAL segments on disk before they are trimmed.
  • Replay time: A larger WAL lengthens ingester startup, which affects rollout pace and readiness timing.
  • Volume behavior: Confirm with your storage class that a rescheduled pod reattaches the same volume and that volume expansion works as you expect.

Before setting the claim size, observe disk usage per pod across a full ingest cycle and compare the results with the sizing guidance in the Loki documentation.

How to configure the WAL and verify it survives a restart

This sequence turns on the Loki ingester write-ahead log, places it on durable storage, and proves with a controlled restart that acknowledged log entries are replayed and queryable afterward. It gives the team a tested baseline before the WAL is relied on in production.

  1. Confirm the Loki version and deployment mode

    Record the exact Loki version running in the test environment and the deployment mode it uses: monolithic, simple scalable or microservices. Check the version against the Loki releases page and confirm the ingester component that owns the WAL is present in that mode. Read the configuration reference for your version before editing anything, because WAL settings and their defaults can change between releases. Done when you have a written note of the version, the mode, and the ingester replica count, and the team agrees the note matches what is deployed.

  2. Place the WAL on a persistent volume

    Mount a persistent volume for each ingester and point the WAL directory at it, so the log survives a pod or process restart. Size the volume from measured ingest rate over a representative period, not from a guess, and leave headroom for replay and bursts. In Kubernetes, confirm the volume is a PersistentVolumeClaim that is not ephemeral and is retained when the pod is rescheduled. Done when each ingester reports the WAL directory on the mounted volume and the volume shows free space after startup.

  3. Enable the WAL in the ingester configuration

    Set the WAL to enabled in the ingester section of the Loki configuration, along with the directory path you prepared, following the write-ahead log section of the official documentation for your version. Keep the configuration in version control so the change is reviewable and reproducible. Roll it out to the test environment only. Done when the ingester starts without configuration errors and its startup logs show the WAL being initialized at the expected path.

  4. Write a known set of test entries

    Push a controlled set of log entries with recognizable content and timestamps through the same path production clients use, such as Grafana Alloy. Record the count of entries sent and the time range, and keep a copy of the test payload so you can compare results later. Confirm the push returns success from the distributor or write path. Done when the sender log and the Loki response confirm the entries were accepted and you have a written record of exactly what was acknowledged.

  5. Run a controlled ingester restart

    In the test environment only, stop one ingester abruptly while data is still in memory, for example by killing the process or deleting its pod, then let it restart on the same volume. Do this with the test entries still within the ingester's in-memory window so the replay path is exercised. Note the restart time and any errors. Done when the ingester has restarted and you have captured its logs from the shutdown and startup.

  6. Check replay and readiness in ingester logs

    Review the restarted ingester logs for messages showing WAL replay of segments before the component starts serving. Confirm the ingester reports ready only after replay completes by checking its readiness endpoint or health status during startup, not only after the process is up. Also check the loki_ingester_wal_corruptions_total metric, which should remain at zero for a clean restart. Done when replay messages appear before readiness, the readiness signal changes only after replay, and the corruption counter has not increased.

  7. Confirm acknowledged entries are queryable

    Query the test entries in Grafana or with LogQL using the same tenant and time range as the original push, then compare the returned count and content with your written record. Any acknowledged entry that is missing after replay is a failure to investigate before the WAL is trusted. Repeat the restart once more to confirm the result is stable. Done when every acknowledged entry is returned exactly once, and the results and log excerpts are saved with the test record.

When WAL recovery trades durability for availability

The most important behavior to understand is that Loki prefers to start with less data rather than refuse to start. When the WAL is corrupted or partly deleted, the ingester recovers whatever it can from the local filesystem and still comes up, so the service is available again instead of staying down until someone repairs the volume by hand. The ingester does not stop to ask whether the missing data matters, and the recovery is not a full restoration of everything that was acknowledged before the failure.

In the corrupted or partly deleted case, the reader loses the entries that sat in the unreadable or removed portion of the WAL. Those entries were acknowledged to the sender but never reached object storage as flushed chunks, so they cannot be recovered from the bucket later. The loss is bounded by what the damaged segments held, which depends on how much data was in memory and not yet flushed at the moment of failure. For a service where recent logs are mainly used for live troubleshooting, keeping the ingester in the ring and continuing to accept new writes is often the better trade. For an audit trail or a regulated record where every acknowledged line matters, that same trade may be unacceptable, and the team should decide that before an incident, not during one. Watch loki_ingester_wal_corruptions_total so a recovery event is visible and can be investigated.

Do not treat this section as the full list of recovery cases. The supplied documentation describes the corrupted and partly deleted case, and you should confirm with the Loki write-ahead log documentation whether other conditions also lead to startup with reduced data and whether any configuration option changes this behavior for your Loki version. Record the answers in your runbook, including who is alerted when a corruption counter increments and what evidence is kept about the affected time window.

Limits to confirm before relying on the WAL

The WAL protects acknowledged data on a single ingester, but it is one layer of a larger durability design. The cards below list the assumptions to test in your environment before you treat the WAL as the answer to a crash or disk failure.

WAL is local to each ingester

The WAL is written to the local filesystem of each ingester, so its protection depends on that node and disk. If a node or disk is lost, the data held only in its WAL is lost with it. Confirm which volume backs the WAL directory on each ingester, whether it is node-local or a network volume, and how replicated ingesters are placed across failure domains. Check the Loki write-ahead log documentation for the replay behavior you will rely on.

Loki WAL docs

Replay time grows with WAL size

On restart, an ingester replays its WAL before it registers as ready, so a larger WAL means a longer period before that ingester accepts traffic again. Measure how long replay takes in a test restart with a realistic write load, and decide how many ingesters can be unavailable at once. Note the WAL size you reached during that test so you can compare it with later growth.

WAL is not a backup

The WAL covers the window between acknowledgment and chunk flush to object storage. It does not replace object storage durability, bucket replication, or backups of your configuration and index. Retention also does not apply to WAL contents in the way it applies to stored chunks. Decide how your object store is protected and tested separately, and document which copy you would restore from after a loss.

Corruption alerts must be wired up

Loki recovers what it can from a corrupted or partly deleted WAL and still starts, so a bad WAL can pass unnoticed. Track the loki_ingester_wal_corruptions_total metric and alert on any increase. Confirm that the alert reaches an on-call channel and that someone knows the recovery steps for your environment.

Sizing guidance varies by release

Disk sizing for the WAL depends on ingestion rate, flush behavior, and the configured WAL directory limits for the release you run. Confirm the sizing guidance and any maximum WAL directory behavior in the documentation for your exact Loki version before setting volume sizes. Re-check this when you upgrade, because defaults and behavior can change between releases.

Simple scalable mode is being removed

The Loki documentation states that simple scalable deployment mode is being deprecated and will be removed with the Loki 4.0 release. If your WAL sizing assumes a simple scalable layout with separate write targets, plan the move to a supported mode before you size the volumes. Check the deployment modes page and factor the migration into your storage and ingester design.

Deployment modes docs

Questions teams ask before they size or change the WAL

Do I still need a write-ahead log if chunks already go to object storage?

Yes, for the window before data reaches object storage. Loki's WAL records incoming data on the local filesystem of each ingester so that acknowledged data survives a process crash, and the ingester replays it before it registers as ready. Object storage holds flushed chunks, but data acknowledged and still held in memory would be lost without the WAL. The WAL does not replace object storage or retention. It closes the gap between acknowledgment and flush, so the disk it uses is a durability dependency that your team must size, monitor and back up in its own way.

How do I alert on WAL corruption with loki_ingester_wal_corruptions_total?

Scrape the ingesters with Prometheus or another compatible backend and alert when loki_ingester_wal_corruptions_total increases. The metric counts corruptions found during replay. Loki recovers what it can and still starts, so a corruption can pass without an outage, which is why the alert matters. Route it to the team that owns the storage, and pair it with alerts on ingester restarts and disk usage on the WAL volume. Confirm the exact label set and alert thresholds against your version of the Loki monitoring documentation before you deploy the rule.

What does a WAL sizing and configuration engagement cost, and what recurs?

Cost comes from the people doing the work and the infrastructure they change. A one-time engagement covers reviewing ingest rates, choosing the WAL volume and ingester layout, setting up alerts, and writing the restore runbook. Recurring costs include the disk capacity you keep provisioned, monitoring, and periodic restore tests. Costs rise with the number of ingesters, the volume of data per ingester, the number of environments and the complexity of your Kubernetes or VM layout. DeployOpen does not publish prices. Ask for a quote built from a written scope that lists each activity, the environments covered and the deliverables.

How long does a WAL sizing exercise take, and what does it need from my team?

Duration depends on how well your ingest data is understood and how many ingesters and environments are in scope. The work needs current ingest rates per tenant, the deployment topology, the storage classes available to ingesters, and a named person who can approve changes to production. Ask the provider to state the duration and the team time it expects from your side in the written scope. Without measured ingest figures, any sizing is a guess, so the first step is usually collecting metrics for a representative period.

Can my internal team size and change the WAL on its own?

Often yes, if the team already runs Loki on Kubernetes or VMs, has Prometheus-based monitoring, and can test restores outside production. The work involves storage performance, pod or process lifecycle, and recovery behavior, so an engineer who has handled stateful workloads should own it. External help is most useful for a first sizing, for reviewing the layout before a major Loki upgrade, or for building the restore test. Your team should decide that based on its own experience with stateful services and its capacity for on-call work.

What should a WAL quote include?

A useful quote lists the Loki version and deployment mode in scope, the ingesters and volumes covered, the ingest measurements that the sizing will use, and the alerts, dashboards and runbooks to be delivered. It should also name what is excluded, such as storage platform changes, object store configuration and compactor work, and who approves changes. Ask how restore tests are scoped, how many environments are included and what acceptance criteria apply. Confirm the Loki version you run against the current releases page before you accept any sizing assumptions.

How do I test a WAL restore without risking production data?

Test in a non-production environment with a copy of the ingester volume or a representative synthetic load. Stop an ingester in a controlled way, restart it, and confirm that it replays the WAL and reports ready. Then check that the expected log lines are queryable and that loki_ingester_wal_corruptions_total stays at zero. Also test a case where part of the WAL is removed to confirm that Loki starts and that the corruption metric and alert fire. Record the results, the Loki version and the disk layout, and repeat the test after changes to storage or upgrades.

Security and operational considerations for WAL volumes

The WAL turns each ingester's local disk into a copy of data that has been acknowledged but not yet flushed to object storage. The cards below cover what that copy exposes, how to detect when it is damaged, and how to change ingesters without losing the replay path.

Treat the WAL as data at rest

Each ingester writes acknowledged log lines to its local filesystem, so the WAL holds customer or internal log content on the node before it reaches object storage. Confirm with your platform team that the WAL directory sits on encrypted volumes, that node access is limited to the operators who need it, and that the volume is covered by the same disk-disposal process as other systems holding sensitive logs. Note that retention rules applied to object storage do not automatically clear WAL files.

Loki WAL docs

Alert on WAL corruption

Loki recovers what it can from a corrupted or partly deleted WAL and still starts, so a failed recovery does not stop the ingester. That makes the counter loki_ingester_wal_corruptions_total the signal to watch. Add an alert on any increase, route it to the team that owns the ingesters, and check which log streams were affected before deciding whether a restore or a re-ship from the source is needed.

Check replay after restarts

Each restarted ingester replays its WAL before it registers as ready, so restart duration depends on how much unflushed data the WAL holds. Measure replay time in your own environment during a planned restart and record it. Use that measurement to set rollout pacing, readiness timeouts and the alert for ingesters that stay unready longer than expected.

Alert on WAL volume capacity

A full WAL volume stops an ingester from recording new data safely, so capacity alerts belong on the WAL mount itself, not only on the node's root disk. Set thresholds early enough to add space or investigate a flush backlog, and confirm with your platform team how fast the volume fills during a normal ingestion peak and during an object storage outage.

Decide whether to back up the volume

The WAL holds data that may not yet be in object storage, so the business must decide whether losing it during a multi-node failure is acceptable. If it is not, plan snapshots or copies of the WAL volumes with a restore procedure that has been tested. Ask your storage team whether the chosen method preserves files consistently while an ingester is writing, and document the recovery point you can actually meet.

Change control for restarts and upgrades

Ingester restarts and version upgrades both replay the WAL, so they belong in change control with a documented order, a pause between nodes and a rollback path. Confirm the upgrade notes for your target version before the change window, and do not delete or reset WAL directories during a rollout unless the upgrade guide directs it. Record each change so corruption alerts can be traced back to a specific restart.

How DeployOpen scopes and delivers Loki WAL work

DeployOpen treats the Loki write-ahead log as part of the ingester design, not a setting to flip on later. We scope the durability target, the ingester storage layout and the disk sizing together, then build, test and document them in your own infrastructure so your operators can run and review them.

How we scope

  • Written scope states which ingesters, volumes and failure cases the WAL design must cover before work starts.
  • We agree the durability expectation for acknowledged data and which crash scenarios your team accepts as recovery cases.
  • Sizing inputs such as ingest rate, retention and replay time are gathered and documented so the quote follows from them.

How we build

  • We configure the WAL directory on dedicated local storage for each ingester, with capacity alerts set before volumes fill.
  • Crash and restart tests confirm replay before ingesters register as ready, using a copy of your real traffic pattern where possible.
  • We wire corruption monitoring on loki_ingester_wal_corruptions_total into your existing alerting and test that the alert fires.

How we hand over

  • You receive the configuration, volume layout, sizing worksheet and the alert rules in version-controlled form.
  • A runbook covers what operators do after a corruption alert, a failed replay and a full WAL volume, written for your team.
  • Knowledge transfer sessions walk your operators through restart tests so they can repeat the checks without us.

How we support

  • Fixed-scope engagements close with a written handover so ownership of the WAL configuration is clear to your team.
  • Ongoing support, upgrades and continuous testing are available as a retainer, including re-sizing when ingest volume changes.
  • Before any Loki version upgrade, we can review WAL settings and retest replay behavior against the new release.

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.