Migrating Loki from BoltDB Shipper to the TSDB index

An older Loki cluster on BoltDB Shipper must move to TSDB before Loki 4.0 removes BoltDB. The work is a planned schema change, a coordinated rollout and a retention plan that lets the old index age out.

On this page

Migrating Loki from BoltDB Shipper to TSDB: what the move involves

The switch is a new period_config entry in schema_config that uses the tsdb index type, schema v13, and a from date set in the future, followed by a rollout of the configuration to every Loki component. Loki applies the change only once each component reads the new configuration, so the work is less about editing one file and more about making sure no pod, VM or replica is still running the old view when the future date arrives. Loki 4.0 removes BoltDB Shipper, so an older cluster that is still indexed by it must complete this change before that release, and a 4.0 upgrade attempted first will fail to start.

Effort depends on four things: cluster size, deployment mode, retention length and how many teams depend on the cluster. The configuration change itself is small. Most of the time goes into confirming the rollout reached every reader, writer, compactor and backend component, checking that queries spanning the boundary return the same results, and agreeing a window with teams whose dashboards and alerts depend on Loki. Deployment mode matters because simple scalable clusters have separate read, write and backend targets that must all pick up the change, and the same work applies to microservices clusters with more pods to track. Confirm the exact steps for your version against the Loki migrate to TSDB documentation before scheduling anything.

What carries over from BoltDB Shipper and what changes for TSDB

This table maps each BoltDB Shipper element in a running cluster to what happens under a TSDB period. Read it before writing the new period_config, because most items stay as they are and only the index store and its ageing change.

ElementWhat happens with TSDBMigration note
Existing log chunksStay in the same object storage bucket and pathsChunks are not rewritten or copied. Confirm the chunk prefix and bucket in your storage config before the change.
Index files in object storageOld BoltDB index files remain readable for their periodNew index files are written under the TSDB period. Do not delete old index files while the old period still covers queried data.
boltdb-shipper entry in schema_configStays in place as the older periodKeep it. Removing it breaks reads of data written before the from date.
New period_config entry (schema v13, tsdb)Applies only to data written from its from date forwardChoose a future from date and roll out the config to every component before it arrives, so all writers agree.
Compactor-managed index tablesCompactor handles both periods during the transitionConfirm compactor version and that it runs against the shared bucket. Watch its logs for errors on the old period.
Tenant IDs and auth_enabledUnchangedTenant IDs are carried in the X-Scope-OrgID header and stored paths. Confirm no tenant mapping changes in the same release.
Retention rulesApplied per period by the compactor. Retention is disabled by defaultConfirm retention_enabled is set. Plan how long the BoltDB period must live before it ages out of your retention window.
Dashboards and alertsQueries are unchanged in LogQLNo query rewrites are expected from the index change itself. Re-run key dashboards and alert rules after the new period starts.

How the period_config change moves a running cluster to TSDB

Loki chooses which index store to use by date. Each entry in schema_config is a period with a from date, and the period that applies to a given log is the one whose date range covers the log's timestamp. Adding a new entry with a future from date and schema: v13 with the TSDB index store means that logs from that date onward are indexed with TSDB, while the earlier period continues to point at BoltDB Shipper. Data written under the old period stays readable through the old index, so queries span both indexes without a conversion job. The mechanism is the one described in the Loki migrate to TSDB guide, and the reader should confirm the exact field names and index store values against that page for their Loki version before editing anything.

The change has to reach every Loki component before the from date arrives. Ingesters, queriers, the compactor and the index gateway all read the schema to decide how to write or look up index data, so a component that still holds the old configuration may write or query against the wrong index. Roll the updated config out to the whole cluster, confirm that each component has restarted or reloaded with the new file, and only then treat the date as live. Build the rollout so that no component is left behind, including Helm values, secrets and any separate config files for read and write paths.

The from date needs a safety margin. Pick a date far enough ahead that the rollout finishes with room to spare, and keep the date in UTC with an explicit day boundary so that every component interprets it the same way. Keep the old period in place rather than deleting it, because the BoltDB data written under it is still needed for queries until retention removes it. Removing the old entry would make that history unreadable. Plan a retention window that covers the old period, and confirm with your team how long BoltDB data must remain queryable before the old period can be retired during a later upgrade.

The phases of the BoltDB to TSDB switch move in order and wait for each check

The switch starts with an inventory of the current schema_config and storage settings, then adds a TSDB period with a future from date after the BoltDB period. The new config must reach every Loki component before that date, and writes are checked against the TSDB period once it takes effect. The BoltDB period stays readable until retention removes its data, and only then is it deleted before Loki 4.0 removes BoltDB.

The ordered phases of the switch, each gated by a decision or check.

The sequence for switching an older cluster to TSDB

This sequence moves a running Loki cluster from BoltDB Shipper to the TSDB index in an order that keeps existing data readable, with a check at each step. It ends with new chunks indexed in TSDB, old periods still serving queries, and the BoltDB period removed before Loki 4.0.

  1. Record the current configuration and index state

    Before any change, copy the schema_config, storage_config and compactor retention settings from every Loki component and store them under version control. Note the existing period_config entries, the object store bucket and prefix they point to, and whether retention is enabled. This record is your rollback reference and the baseline for later comparison. Done when each component's live configuration matches the saved copy and the change record names the current index type for every period.

  2. Confirm the Loki version and deployment mode

    Check the running Loki version and whether the cluster uses monolithic, simple scalable or microservices mode, since the rollout touches every component in that topology. TSDB is the recommended index store for Loki 2.8 and newer, so a cluster on an older release should be upgraded first by following the official upgrade guide. Simple scalable mode is deprecated and removed in 4.0, so note any planned mode change separately. Done when the version and mode are written into the change record and approved by the platform owner.

  3. Choose a future from date with margin

    Select a from date in the future, early enough that the configuration can reach every component before it takes effect. The from date determines which chunks are written with the TSDB index, so all components must load the change before that date arrives. Agree the date with the people who operate the write and read paths and record it in the change plan. Done when the date is recorded, every owner has confirmed the window, and no maintenance activity is scheduled across it.

  4. Add the TSDB period with schema v13

    Add a new entry to period_config with the chosen from date, schema set to v13, and store set to tsdb. Point it at the same object store and prefix pattern as the existing period so chunks stay in one location. Leave the BoltDB entry unchanged so older data remains readable. Validate the file in a non-production copy before editing production. Done when the new config is saved as a reviewed change, the BoltDB period is untouched, and the validation run starts without configuration errors.

  5. Roll the configuration out to every component

    Apply the updated configuration to all components, including write, read, backend and any ruler or compactor targets, using the same process your team uses for other config changes. The migration takes effect only when every component has loaded the new schema. Restart or reload according to your deployment method, then check that each component reports the new period_config. Done when every component shows the TSDB period, none still runs the old file, and the rollout log has no schema errors.

  6. Verify TSDB indexing and boundary queries

    After the from date passes, write test logs and confirm that new index files are created under the TSDB period in the object store. Then run queries that span the boundary between the BoltDB and TSDB periods and confirm they return both older and newer lines without gaps. Keep both periods in place while queries span the boundary, and watch ingestion and query error rates. Done when new chunks show TSDB index files, boundary queries return complete results, and no component logs index read errors for either period.

  7. Plan retention so the BoltDB index ages out

    Retention is disabled by default, and the compactor deletes data only after retention_enabled is set and rules are defined. Set the retention window so that all data indexed under the BoltDB period is past retention before you remove that period. Stream rules must each cover at least 24 hours. Confirm the retention configuration with the official retention documentation before enabling it in production. Done when the retention plan shows the date after which no BoltDB-indexed chunks remain in the window and the compactor reports retention runs.

  8. Remove the BoltDB period before upgrading to Loki 4.0

    Once the retention window has passed for all BoltDB-indexed data, remove the BoltDB period_config entry and any boltdb-shipper settings from the configuration. Loki 4.0 removes BoltDB and fails to start if the schema or storage configuration still refers to it, so this cleanup must happen before the 4.0 upgrade. Keep the saved record from the first step as a reference. Done when the configuration contains only TSDB periods, a test startup on the target version succeeds, and the removal is recorded in the change log.

How the rollout differs by Loki deployment mode

Monolithic mode runs Loki as a single binary that handles every role in one process. The rollout here is the smallest of the three because there is one configuration source to update. You add the new period_config entry to schema_config, restart the process so it reads the change, and confirm that writes and queries continue to work. The Loki documentation places monolithic mode at up to about 20 GB of logs per day, so teams on this mode usually have a short list of hosts to check.

  • One config file: Edit the single Loki configuration file that the binary loads, including any copy kept in configuration management.
  • One restart: Schedule a restart during a quiet window, since the process handles ingestion and queries together.
  • Future from date: Set the new entry's from date to a day after the change will be in effect everywhere, so the index switch is not applied before the restart completes.
  • Old period retained: Leave the existing BoltDB Shipper period in place so older chunks stay readable.
  • Backend location: Confirm the object storage path and any index prefix for the TSDB period do not overlap the old one.

Before you close the change, confirm that the running process reports the new schema and that a query over a time range spanning the cutover returns data from both indexes.

What drives the effort and timeline of the switch

The table lists the factors that change how much work the TSDB switch takes and how long it runs, with what to ask for in a quote for each. No duration or fee is given here, because the quote follows from the written scope. Read each row against your own cluster to see which factors make the job larger.

DriverWhy it mattersWhat to ask for in a quote
Deployment mode and component countEvery component that reads or writes the index must receive the new period_config, so more components mean more rollouts and more places a stale config can linger.A component list per cluster, with the rollout order and how each component is verified after restart.
Number of clusters and environmentsEach cluster has its own schema_config, storage and retention settings, so the change is repeated per cluster and per environment.A per-cluster and per-environment breakdown, stating which environments are in scope and which are handled by your team.
Retention lengthThe BoltDB index stays readable until its period ages out, so long retention keeps the old index and its query path alive for longer.A retention review that states how long each index period must stay queryable and who signs off on it.
Tenants and cross-boundary dashboardsDashboards and alerts that span the old and new periods need checking, and tenant-specific limits may need matching changes.An inventory of dashboards, alert rules and tenants that query across the date boundary, with a check plan for each.
Config management maturityChanges made through GitOps or Helm values are easier to review and roll back than hand-edited files on each host.A statement of where configuration lives today and whether the change goes through your pipeline or a manual process.
Change windows and approval rulesStorage and index changes often need a set window, a change ticket and a named approver, which can set the pace more than the technical work.The change calendar, approval steps and any freeze periods the rollout must fit inside.
Non-production testingA migration that has not been rehearsed on a copy of production data is harder to trust and harder to roll back.The test environments included, the data volume they hold, and the test cases for queries across the boundary.

What goes wrong during a BoltDB to TSDB switch and how to prevent it

The BoltDB to TSDB switch is mostly a sequencing problem. Each risk below comes from a step done too early, too late, or not everywhere, and each card names the check that prevents it. Review them before the first config change and again before any period is removed.

Future from date arrives too early

The new period_config only takes effect for writes once every component has loaded it. If the from date is earlier than the actual rollout, some components write the new index format while others still write BoltDB, and the two indexes split your query coverage. Pick a from date that is comfortably after the last config rollout is confirmed on every instance, and verify each component's loaded config before that date arrives.

Migrate to TSDB docs

Component missed in the rollout

The schema change must reach every Loki component, including the ones that do not ingest logs, such as the ruler and compactor. A component running an old config may read or compact the index incorrectly, and the failure may not appear until a rule evaluates or retention runs. Build a list of every component from your deployment manifests and confirm each one shows the new schema config before you rely on the migration.

BoltDB period removed too early

Older chunks are indexed in the BoltDB period, so removing that period_config entry or its storage settings makes that data unreadable. Keep the old period in place for as long as logs written under it are still inside your retention window. Before any cleanup, run queries that span the boundary date in Grafana and confirm results from both sides of it.

Retention removes the old index before queries are confirmed

Retention is disabled by default, so the team must decide when it turns on and what it deletes. If retention is enabled before the new index is verified, the compactor can remove old index entries that the team has not yet tested against. Confirm that dashboards, alerts and ad hoc LogQL queries return expected results across the boundary, and only then enable retention with a period that leaves the old index in place for its full window.

Retention docs

Config drift between environments

Staging, test and production often hold separate copies of the Loki config, and the schema_config block can diverge as hotfixes land in one place. A migration validated in staging may not match production, and the reverse is also true. Keep the schema_config block in version control, promote it through the same pipeline as other Loki config, and diff the rendered config of each environment before the switch.

Loki 4.0 upgrade while BoltDB settings remain

Loki 4.0 removes BoltDB, along with other older stores, and fails to start if the schema or storage configuration still refers to them. A team that plans to upgrade later may find the upgrade blocked by a leftover BoltDB period or storage block. Schedule the TSDB switch and the removal of old periods before any Loki 4.0 upgrade work, and treat a config that still mentions BoltDB as a blocker for that upgrade.

Keeping old periods readable until retention removes them

Old BoltDB Shipper data stays queryable for as long as its period remains in schema_config. Adding the TSDB period does not delete anything, and removing the old period entry too early would make chunks written under it unreadable. The old period stays in place until retention has removed the data it covers, and that removal is the only thing that ends the BoltDB index's life. Retention is applied by the compactor, and it is disabled by default, so until you deliberately enable it, logs are kept indefinitely. Confirm that the compactor is running and that retention_enabled is set in the configuration you roll out, because a cluster that never enables retention will keep its BoltDB period forever.

Retention can be set globally, per tenant, or per stream selector, and each stream rule must be at least 24 hours. Plan the window in the order the data is actually aged out: pick the retention period your data-keeping requirements call for, then decide whether it applies to every tenant or only to specific ones. Per-stream rules are useful when a noisy stream needs a shorter window than the rest, but every rule you add is another setting to review during the migration. Write the planned removal date down for the BoltDB period: it is the write cutover date plus the retention period, and it is not reached until the oldest chunk under that period has been deleted. Illustrative example: if logs written under the BoltDB period must be kept for 90 days, the BoltDB index cannot retire before that window has passed.

Before you remove the old period from schema_config, confirm the retention window with the people who own the requirement, such as the compliance lead, the security team and the owners of any legal hold or audit obligation. Ask them to state the minimum period for each tenant in writing, and check that no tenant needs data held longer than the retention you configured. Then verify on the cluster that the compactor has been processing deletions and that queries over the oldest time range you still need succeed. Removing the BoltDB period early is the step that can make historical logs disappear without an error that points back to the cause, so treat it as a gated change with a sign-off, not a cleanup task.

Documented paths and references for the switch

The four references below cover the steps, the storage layout, the retention behavior and the 4.0 removal that together decide how this switch is planned. Read them in this order before changing any production configuration, and keep the versions you read pinned to the Loki version you actually run.

Official migrate-to-TSDB guide

This is the step-by-step source for the change itself: adding a new period_config entry under schema_config with a future from date and schema v13 set to the TSDB index store. Check that the from date falls after the rollout you can complete across every component, and confirm the exact index and store values against the guide for your Loki version. Note that the change only takes effect once all components load the new configuration.

Migrate to TSDB guide

Storage and index layout

The storage documentation explains how Loki keeps compressed chunks and the index in object storage and why TSDB is the recommended index store for Loki 2.8 and newer. Use it to confirm which index stores are deprecated in your version and how the old BoltDB Shipper periods sit alongside the new TSDB period. Check that your object store is one the docs recommend for production, since S3-compatible stores and the filesystem are supported but not typically recommended for production.

Loki storage docs

Retention behavior and rules

Retention is applied by the compactor and is disabled by default, so an unconfigured cluster keeps logs indefinitely. This matters because the old BoltDB index only stops serving data after every chunk it references is removed. Review the global, per-tenant and per-stream rules, and remember that each stream rule must be at least 24 hours. Confirm that retention_enabled is set deliberately before you plan the cut-over date.

Retention docs

Loki 4.0 removal of BoltDB

Loki 4.0 removes BoltDB (boltdb-shipper), along with Google BigTable, Apache Cassandra, Amazon DynamoDB and the gRPC store. Loki 4.0 fails to start if the schema or storage configuration still refers to one of them, so any cluster still on BoltDB Shipper must finish the switch before upgrading. Check your planned upgrade path against the Loki release list and the upgrade guidance, and confirm the release date with the Loki GitHub releases page rather than assuming it.

Loki releases on GitHub

Questions teams ask before switching Loki to TSDB

How much does a BoltDB Shipper to TSDB switch cost?

The cost depends on how many clusters, components and environments are involved, how the current configuration is organized, and how many test cycles your change process requires. The config change itself is small: a new period_config entry with a future from date and schema v13. Most of the effort sits in rollout across every component, validation in a test environment and change approvals. Costs are one-time for the migration and recurring only if you retain a support or upgrade arrangement afterward. Ask for a quote that lists the environments in scope, the components to be rolled out, the test and rollback steps, and who performs each task. Confirm with your own team whether internal labor or a partner carries the work.

How long does the migration to TSDB take?

Duration is driven by the size of the cluster, how many environments must be changed in sequence, and how long your change windows and approvals take. The configuration change is quick to write, but the rollout must reach every Loki component before the new period takes effect, and that rollout needs verification at each stage. Ask any provider for a schedule that separates test rollout, production rollout and post-change checks, and for the dates by which Loki 4.0 would fail to start on the old configuration. Confirm the Loki 4.0 release date against the Loki releases page before you commit to a deadline.

What must our team provide before the migration starts?

Before any change, you need to provide four things. First, the current Loki configuration, including schema_config, storage_config and the compactor and ruler settings, for every environment. Second, object storage access with credentials that the team can use to verify that old and new index files are readable. Third, agreed change windows and a named approver for each environment. Fourth, a test environment that mirrors production schema and storage, so the rollout can be rehearsed. Ask the provider to confirm each of these in writing, along with the rollback steps they will use if a component does not pick up the new period.

Can our in-house team do the TSDB switch without outside help?

Yes, many teams can, provided they have engineers who understand Loki's schema and storage configuration and who can run a staged rollout. The migration is a configuration change plus a disciplined rollout, so the main risks are missed components and insufficient testing rather than technical complexity. Ask your team three questions: who owns the Loki config, who can roll out every component and verify it, and who will run the retention plan afterward. If any answer is unclear, a fixed-scope engagement with written deliverables can cover the gap. Confirm that the internal team has tested the rollback path before production work begins.

What happens to the data already stored in BoltDB Shipper indexes?

Existing data stays where it is. Loki keeps the old BoltDB Shipper period in period_config so it can still read existing chunks and indexes, while new data is written with TSDB once the future-dated period takes effect. The old index is not rewritten in the switch. It ages out as retention removes the data it refers to, which is why retention planning is part of the migration. Ask for a plan that records the date the new period starts, the retention settings that will remove older data, and how the team will confirm that old periods remain readable until their data expires.

Will queries break during the switch?

Queries should keep working if the rollout is done correctly, because the old period stays in configuration and Loki reads across both periods. The main risk is a component that has not loaded the new configuration, which can lead to inconsistent behavior between ingesters, queriers and compactors. Plan a test query set that covers recent logs, logs from before the switch and long-range queries, and run it before and after each rollout stage. Ask the provider to show which dashboards and alerts will be checked and how query latency will be compared against the baseline.

What should we do if our cluster runs simple scalable mode?

Treat the TSDB switch and the deployment mode change as separate projects, because simple scalable mode is deprecated and the Loki documentation states it will be removed with Loki 4.0. Running a TSDB migration on a simple scalable cluster first can be reasonable, but the schema change must still be rolled out to every read, write and backend target. Ask for a written sequence that shows whether the deployment mode change happens before or after the TSDB switch, and how each change will be tested. The deployment mode migrations listed for Loki cover the alternatives. Confirm your target mode and timing with your own platform owners before work starts.

How DeployOpen scopes and delivers the Loki TSDB switch

DeployOpen plans the BoltDB Shipper to TSDB switch as a written, fixed-scope engagement inside your own infrastructure. We inventory the current schema and storage configuration, stage the future-dated period_config change, and document each step so your platform team can run and review it.

How we scope

  • Inventory the current schema_config, storage settings and every Loki component that reads them before any change is planned
  • Agree the future from date, the rollout order across components and the rollback point in writing before work starts
  • Define how long the old BoltDB Shipper period must stay readable and which retention settings govern when it ages out

How we build

  • Add the new TSDB period_config with schema v13 in a staging copy of your configuration and validate it before production
  • Roll the change out to every Loki component in a controlled sequence and confirm each one reports the same configuration
  • Test ingestion and queries across the period boundary, including logs written before and after the switch date

How we hand over

  • Deliver the final configuration, the rollout runbook and the verification checklist used during the change
  • Document the retention plan so your team can confirm when the old index has aged out and no longer serves queries
  • Walk your operators through the Loki 4.0 removal of BoltDB, so they know which settings must never reappear

How we support

  • Offer ongoing support, upgrades and continuous testing for Loki as a retainer after the switch is complete
  • Review future Loki upgrade planning against the TSDB configuration you ran in production
  • Confirm the scope, timing and any follow-on work with your team in writing before each new piece of work begins

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.