When your Loki ruler needs planned operations
If you run LogQL alert or recording rules in a self-hosted Loki, the ruler is the component that must stay dependable, and it needs planned operations before it becomes a problem. The page question is how to run the ruler reliably: where its rules are stored, how rule evaluation is spread across ruler replicas, and what happens to pending remote-write samples when the ruler restarts. The ruler evaluates LogQL alerting and recording rules on a schedule. Alerting rules send firing alerts onward, and recording rules write their results as metrics, which can be pushed to a Prometheus-compatible backend through remote write.
This topic covers three areas that the Loki documentation treats as separate configuration concerns but that interact in practice. The first is rule storage, which decides where rule files live and how replicas read them. The second is shuffle sharding, which controls how rule evaluation is distributed and can be configured separately from the query path and the index gateway. The third is the remote-write write-ahead log (WAL), which protects recording rule samples across crashes. Planning these together matters because a sharding change alters which replica owns a rule, and a storage or upgrade decision alters what state survives a restart.
Before you change any of these settings, confirm the ruler configuration in your current version against the Loki shuffle sharding documentation, and check the unreleased upgrade notes in the Loki upgrade guide. Those notes list a breaking change in which the ruler always wipes its remote-write WAL on startup. If you plan a move to Loki 4.0, decide now whether losing unsent recording rule samples at restart is acceptable, and whether your Prometheus-compatible backend can tolerate gaps, so the rollout plan accounts for it.
Shuffle sharding options for query, ruler and index gateway
Shuffle sharding on the query path limits how many query-side components serve a given tenant. Instead of every tenant spreading across every querier, each tenant gets a subset of the pool. A noisy or expensive tenant then affects fewer of the other tenants' queries, which matters most in a shared cluster where several teams or customers query the same Loki.
- Isolation scope: A tenant's heavy queries are confined to its shard, so other tenants on the same queriers see less contention.
- Shard size: Larger shards spread load more evenly but reduce isolation. Smaller shards isolate tenants more strongly but need enough replicas to stay available if a querier fails.
- Single-tenant clusters: If you run one tenant only, shuffle sharding on the query path adds little, and the shard size question mostly becomes a sizing question.
- Replica layout: Confirm how many queriers run per zone or node pool, since a shard drawn from too few instances can concentrate load on a few hosts.
- Tenant count: Ask how many tenants will query concurrently at peak. The number of tenants relative to the pool size determines how much overlap you should expect between shards.
Confirm the tenant count, expected peak concurrency and querier replica layout against the Loki shuffle sharding documentation before you set any shard size.
Shuffle sharding for the ruler controls which ruler instances evaluate rules for a given tenant. Rule evaluation is continuous work, so a tenant with many or expensive LogQL rules can consume a large share of ruler capacity. Sharding the ruler keeps one tenant's rule load from dominating the evaluation pool for everyone else.
- Rule load per tenant: Count rule groups and the cost of each expression. Expensive metric queries used for recording rules usually drive ruler CPU and memory more than the number of alert rules.
- Ruler replicas: Each tenant's rules are evaluated by its shard. If a ruler instance fails, confirm that another instance in the shard takes over evaluation without gaps.
- Remote-write dependency: Recording rule output is pushed onward, so ruler sharding changes which instance writes which samples. Test this path together with the ruler WAL behavior covered elsewhere on this page.
- Tenant mix: A cluster with a few large tenants and many small ones needs different shard sizes than one with uniform tenants.
- Change control: Changing shard size moves tenants between rulers, so plan the change in a maintenance window and verify that rule evaluation resumes on the new instances.
Before choosing values, confirm the number of rule groups per tenant, the ruler replica count and whether the remote-write path can absorb a change in which instance sends samples.
Shuffle sharding for the index gateway controls which index gateway instances serve index lookups for a tenant. The index gateway reads index data from object storage and answers queries that need it, so its sharding affects query latency and the load placed on the object store when many tenants search at once.
- Index lookup load: Tenants with broad label selectors or long time ranges generate more index requests. Sharding limits how many gateways absorb that work.
- Storage access: Confirm your object storage request limits and cache layout, because several gateways reading the same index can multiply requests if shards overlap heavily.
- Gateway replica count: Small gateway pools leave little room for a shard to survive an instance loss. Confirm the replica count per zone before choosing a shard size.
- Dependency on the index store: The index gateway only applies where your deployment uses it. Confirm that your index store and deployment mode use this component before you tune it.
- Validation: Measure index lookup latency for representative tenants before and after a change, using the same query set.
Confirm the index gateway replica layout, the object storage request profile and the expected concurrent tenant count against the Loki shuffle sharding documentation before choosing a shard size.
Shuffle sharding is set per component, so the three settings can differ. A common approach is to decide the isolation goal first, then size each shard from the replica layout you actually run. Start with the component where tenant contention is visible in your monitoring, rather than tuning all three at once. Changing one component at a time makes it easier to tell which change affected query latency, rule evaluation or index lookups.
- Start from observed contention: Identify which component shows queueing or latency under load before you set a value.
- Keep shards above the failure margin: A shard should still have healthy instances after one zone or node goes down.
- Record the baseline: Note tenant count, replica counts and key latencies before you change anything.
- Change one component at a time: Apply, measure and then move to the next component.
- Document the decision: Keep the chosen values with the cluster configuration so later upgrades do not reset them silently.
Recheck the chosen values against the Loki shuffle sharding documentation for your version before rollout, because defaults and option names can change between releases.
How rules, evaluation and remote write fit together
The path starts with rule files in object storage, which the ruler replicas load and evaluate against the query path, with shuffle sharding deciding which replicas take which rules. Results leave through the remote-write WAL toward a Prometheus-compatible backend. The WAL and the startup behavior are the points to plan for: in the 4.0 upgrade notes, the ruler always wipes its remote-write WAL on startup, so samples buffered there can be lost on restart.
Rule flow from storage through evaluation and the remote-write WAL to the backend.
What the 4.0 change does to the remote-write WAL
The ruler always wipes its remote-write WAL on startup. That is the point to plan around. Loki's unreleased upgrade notes list this as a breaking change, and the Loki ruler uses a write-ahead log to hold recording rule samples before they are sent through remote write to Prometheus, Mimir or Thanos. If the WAL is cleared when the ruler starts, any samples that were written to the log but not yet delivered to the receiver are lost, and the gap appears as missing points in the recorded series. A restart caused by a crash, a node drain, a rolling update or a configuration change can all trigger this, so the exposure is not limited to planned upgrades.
Before upgrading to a 4.0 release, the team should decide how much sample loss the recording rules can tolerate and whether the receiving system can absorb a gap. Recording rules that feed dashboards may accept a short hole. Rules that feed alerting or capacity reports may not. Review which recording rules use remote write, how often they evaluate, and how long a rollout keeps individual ruler replicas restarting. Schedule the upgrade in a window where restarts are controlled, and check whether ruler replicas can be restarted one at a time so that at least some remote-write paths stay active.
The exact behavior, the release it applies to and any supported mitigation must be confirmed in the Loki upgrade guide for the target release before you change anything. The guide was unreleased when this was researched, so the wording may change in the final release notes. Ask the upgrade plan to state which ruler settings, if any, affect the WAL, and test a restart on a non-production ruler with a known recording rule to measure the gap in your own environment.
How to set up ruler storage and sharding
This sequence takes a Loki ruler from a confirmed version and deployment mode to rules stored in object storage, sharded evaluation per tenant and series arriving at a remote-write backend. Each step ends with a check you can run before moving on. Confirm every setting against the docs for your exact Loki version.
Confirm version and deployment mode
Check which Loki release you run and which deployment mode it uses before changing the ruler. The Loki releases page lists v3.7.8, published September 17, 2026, and the deployment docs describe monolithic, simple scalable and microservices modes. Monolithic suits smaller log volumes, while simple scalable is being deprecated and removed with the Loki 4.0 release, so a cluster on that mode needs a migration decision first. Your platform team owns this decision. The check is that the running version matches the release you planned against, confirmed with
loki -versionon the ruler's binary or image.Configure object storage for rule files
Point the ruler at an object store for rule files, using a bucket and credentials dedicated to rules. The Loki storage docs recommend Amazon S3, Google Cloud Storage or Azure Blob Storage for production. They note that S3-compatible stores such as MinIO and the local filesystem are supported but not typically recommended for production. Keep rule group definitions in version control and let your delivery pipeline sync them to the bucket, so the bucket holds the runtime copy. The check is a test rule group uploaded to the bucket, loaded by the ruler, and visible in the ruler's logs or API output.
Set shuffle sharding limits per tenant
Set ruler shard size for each tenant so that tenant's rule groups evaluate on a defined subset of ruler replicas. Shuffle sharding can be configured separately for the query path, the ruler and the index gateway, so set the ruler values explicitly and size them from the rule load of each tenant, not from query-path settings. Start with the tenants that run the heaviest rule sets and record each chosen value in your configuration repository. The check is that the effective limit for each tenant shows the value you set in the runtime configuration your version exposes, and that rules for two tenants land on different replica subsets.
Enable remote write to the backend
Enable the ruler's remote write and point it at the metrics backend your team chose, such as Prometheus, Mimir or Thanos. Confirm the backend accepts writes from the ruler's network path and that any tenant identifiers or authentication headers match what the backend expects. Settle the WAL plan now. The unreleased upgrade notes for Loki state that the ruler always wipes its remote-write WAL on startup, a breaking change tied to the 4.0 line. Samples held in the WAL will not survive a ruler restart on that release, so plan restarts for maintenance windows and make sure your rules can recompute their output. The check is a test write that the ruler logs as successful and the backend accepts.
Verify rule evaluation on the ruler
Confirm that each rule group evaluates on schedule and produces results. Read the ruler's logs for evaluation errors and watch the ruler's evaluation metrics through the monitoring you already run. Push a known log pattern into a test stream for one tenant and confirm the matching rule's output changes as expected. Record the result as the baseline for that tenant so later changes have something to compare against. The check is no evaluation errors across a full evaluation cycle and the test pattern producing the expected value.
Verify series arrive at the backend
Query the backend for the recorded series and compare them with the ruler's output. Confirm that metric names, labels, tenant identifiers and timestamps match, since mismatched labels are a common reason series appear to be missing. Then restart the ruler in a maintenance window and confirm the series resume after startup, noting which samples were lost from the WAL. The check is that the backend returns the expected series for every tenant before and after the restart, and that the restart result is written into your runbook with the Loki version it applies to.
Security and operational risks in running the ruler
Running the ruler puts rule files, evaluation and write credentials in one component that feeds your alerting and metrics. The four risks below overlap at the points where tenants, secrets, access and upgrades meet, so review them together before the ruler serves production traffic.
Tenant isolation of rules and evaluation
Rules are stored and evaluated per tenant, so one team's rule group can be written against another team's streams if tenant IDs are handled loosely. Confirm that every rule upload and API call carries the expected X-Scope-OrgID header, that per-tenant limits cap how many rules and evaluations each tenant can consume, and that a misconfigured rule in one tenant cannot degrade evaluation for others. Test this with two tenants before go-live.
Multi-tenancy docsCredentials for storage and remote write
The ruler needs credentials for the object store that holds rule files and, when recording rules are enabled, for the remote-write endpoint that receives samples. Both are long-lived secrets that the ruler reads at runtime. Use dedicated, least-privilege identities for each, scope object store access to the ruler's bucket or prefix, and rotate them through your secrets manager rather than embedding them in configuration files.
No built-in authentication layer
Loki has no built-in authentication, so access to its API must come from an authenticating reverse proxy such as nginx, HAProxy, OAuth2 Proxy or Pomerium. Keep the ruler's API and any rule management endpoints off public networks, and make sure the proxy enforces identity before it sets or forwards the tenant header. A direct route to the ruler port bypasses that control and lets any caller read or change rules.
Monitoring ruler health
A ruler that stops evaluating fails quietly, because alerts simply stop firing. Monitor evaluation success and failure, rule group evaluation duration, and whether remote-write samples are being delivered, and alert on gaps rather than only on errors. Add an independent heartbeat alert so a silent ruler is noticed. Confirm which ruler metrics your Loki version exposes before building dashboards on them.
Planning upgrades around the WAL change
Loki's unreleased upgrade notes describe a breaking change in which the ruler always wipes its remote-write WAL on startup. Any restart or upgrade of the ruler can therefore discard samples that were written but not yet delivered. Before upgrading, check that the remote-write target has caught up, record the current rule set and configuration, and plan the restart window so recording rule gaps are understood and accepted or backfilled.
Upgrade notesQuestions teams ask before running the Loki ruler
What drives the cost and effort of running the Loki ruler?
The cost has three parts: one-time design and build work, the infrastructure the ruler and its object storage run on, and recurring operation after go-live. The main drivers are the number of tenants and rule groups, how heavy the LogQL expressions are, how much log volume they scan, and whether recording rules push samples to Prometheus, Mimir or Thanos through remote write. Each remote write target adds testing and monitoring work. One-time work includes rule migration, WAL restart testing and runbooks. Recurring work includes Loki upgrades, monitoring the ruler, on-call and cloud spend. Ask any quote to itemize these parts separately, and to state which ones are fixed and which depend on the number of rules you plan to run.
How long does a typical Loki ruler setup take?
It depends on scope, and no researched duration applies to every environment. The main variables are whether Loki is already running, how many tenants and rule groups you have, whether recording rules feed a remote write target, whether you are migrating an existing rule set, and which deployment mode you choose. The Loki documentation says simple scalable mode is being deprecated and removed with the 4.0 release, so a new build should target a mode that stays supported. DeployOpen plans most engagements as fixed scope, with deliverables and timelines agreed in writing before work starts. Ask for a written scope and timeline that lists the environment assumptions behind each date.
What does a Loki ruler project need from our team?
Your team supplies the environment, decisions and reviews that no outside party can make for you. Expect to name an owner for the object storage buckets and access keys, a contact who knows your alert routing and on-call rotation, and someone who can approve configuration changes and Loki version upgrades. You will also need test access to a non-production environment, and a reviewer who can decide which LogQL expressions are alerts and which are recording rules. For recording rules, your metrics owners must confirm the target system, retention and label conventions. Agree these responsibilities in the written scope so that gaps are visible before build starts.
Can our own engineers run the Loki ruler themselves?
Yes, if the team has skills in object storage, Loki configuration, your deployment platform and monitoring Loki itself. The official documentation covers deployment modes, storage, retention, multi-tenancy and shuffle sharding, so a capable team can work from those sources. The harder parts are the ruler's remote-write WAL behavior, shuffle sharding settings for each component, and upgrade steps that Loki documents in its upgrade guide. Check whether your team has tested a ruler restart and an upgrade in a non-production environment. Many organizations split the work: an internal team runs day-to-day operations while an outside partner plans, implements and documents the setup. DeployOpen offers ongoing support, upgrades and continuous testing as retainers.
How does the 4.0 WAL change affect our planning?
Loki's unreleased upgrade notes list a breaking change: the ruler always wipes its remote-write WAL on startup. The WAL is what holds recording rule samples before they reach the remote target, so any samples that exist only in the WAL at restart cannot be replayed from it. Plan for this in three places. First, decide whether gaps in recorded series are acceptable for each recording rule, or whether another source can backfill them. Second, schedule ruler restarts and upgrades with that gap in mind. Third, check the final upgrade notes for the exact version you deploy, because the change comes from documentation that is not yet released. Test the behavior in a non-production environment before you commit to a timeline.
How does shuffle sharding change rule evaluation?
Shuffle sharding gives each tenant a subset of the instances for a component instead of spreading all tenants across every instance. Loki lets you configure it separately for the query path, the ruler and the index gateway, so ruler settings do not have to match query settings. The benefit is a smaller blast radius: a heavy or misconfigured tenant affects fewer tenants when it overloads its shard. The cost is planning work, because each shard size must fit your tenant count and rule load, and a shard that is too small becomes a bottleneck. Test shard settings with realistic rule counts before production, and review them after you add tenants or rules. The shuffle sharding documentation lists the settings for each component.
Does the simple scalable deployment mode still suit a ruler setup?
Plan around the fact that it does not stay supported. The Loki documentation states that simple scalable deployment mode is being deprecated and will be removed with the 4.0 release. Simple scalable mode separates read, write and backend targets, so teams running it will need to choose a supported path before that release. The documented options are monolithic mode, which the docs describe as suited to up to about 20 GB of logs per day, and microservices mode for very large clusters. Your choice depends on daily log volume, query load and how many ruler instances you need. Confirm the current mode guidance in the deployment modes documentation before you finalize the design.
Which Loki release should we plan the ruler around?
Plan around a released version and check its release notes before you commit. The Loki GitHub releases page lists v3.7.8, published September 17, 2026, as the latest release in the sources reviewed for this page. Confirm the current release on that page at the time you start, because newer versions may change ruler behavior. Upgrade plans should cover the configuration changes between your current version and the target version, and the unreleased notes should be checked for changes that will land in later releases. Ask any partner to name the Loki version the scope covers and to state how upgrades after go-live are handled.
How DeployOpen scopes Loki ruler operations
A DeployOpen engagement on the Loki ruler starts with a written scope that names the rule groups in play, the storage backend holding rule files, the sharding settings for rule evaluation and the remote-write targets that receive recording rule output. The scope also states what is out of bounds, such as changes to the log ingestion path or the query tier, so that the ruler work can be reviewed and priced against a defined set of components. Before work begins, the reader should confirm which rule types they run (alerting, recording or both), where rule files are kept, and whether the ruler is deployed as its own target or shares a process with other components in their chosen deployment mode.
The configuration review is the core of the early work. The engineer reads the ruler's storage settings, the shuffle sharding configuration for the ruler, the remote-write client settings and the WAL location, then checks them against how the cluster actually behaves under load. Where the configuration is unclear or conflicts with the documented behavior, the review records the gap and the fix. The output is a written list of changes, each tied to a reason, so the client's platform team can approve, defer or reject them. Upgrade planning follows from the same review. Because the unreleased upgrade notes describe a breaking change in which the ruler always wipes its remote-write WAL on startup, the plan must identify any recording rule samples that are still buffered before an upgrade and decide how the team will accept or prevent their loss. Confirm the exact behavior against the release notes for the version you intend to run before the plan is finalized.
Ongoing support can be added as a retainer once the initial scope closes. A retainer typically covers version tracking, reviewing upgrades against the WAL change and any later breaking changes, and checking rule health after configuration changes. Ask any partner, DeployOpen included, to state in the quote which of these activities are fixed in scope, which are billed on demand and which recur on a fixed cadence. The reader should also ask how changes are tested before they reach production and who holds the rollback decision if a ruler upgrade causes missed evaluations.
How DeployOpen delivers Loki ruler operations
DeployOpen plans the ruler around your rule storage, shard layout and remote-write targets before anything changes. We build, test and document the setup in infrastructure you control, then hand it over with a runbook your team can operate and review.
How we scope
- We inventory your current Loki version, deployment mode and the rule groups the ruler must evaluate
- We agree the rule storage backend, shuffle sharding settings and remote-write destinations in writing
- We confirm whether your upgrade path crosses the 4.0 change that wipes the ruler's remote-write WAL on startup
- Engagements are fixed-scope, with deliverables and timelines agreed before work starts
How we build
- We configure rule storage in your object store and check that rule files load and evaluate as expected
- We set shuffle sharding for the ruler separately from the query path and index gateway, then test failover behavior
- We test remote-write delivery and document how samples are handled across ruler restarts and crashes
- We verify alerts and recording rules end to end against a staging copy before production cutover
How we hand over
- We deliver configuration, rule repository layout and a written operations runbook for your team
- We document the WAL behavior your version has, including what is lost on restart, and the steps to recover
- We walk your engineers through restart, rule reload and sharding changes, and record the sessions
- We agree a retest plan for each upgrade so the ruler is checked again after version changes
How we support
- Ongoing support, upgrades and continuous testing are available as retainers
- We review ruler metrics and remote-write errors with your team on the agreed cadence
- We plan upgrades around release notes, including unreleased breaking changes flagged in the Loki docs
- Ask any provider to confirm which ruler and WAL behavior applies to your exact Loki version

