Loki Error Guide: 'invalid schema config' — Set 24h Index Periods and Add New Schemas Safely
Fix Loki 'invalid schema config: boltdb-shipper works best with 24h periodic index config': set index period to 24h and align store/schema v13.
- #loki
- #logging
- #troubleshooting
- #errors
Fixing errors like this? Get 500 free DevOps AI prompts
500 copy-paste AI prompts for the stack you actually run — one PDF, free.
Overview
Loki validates schema_config at startup and refuses to run when an index store is paired with an incompatible index period or schema version. The most common form calls out the 24h requirement directly:
invalid schema config: boltdb-shipper works best with 24h periodic index config
You will see closely related variants for TSDB and for unknown versions:
schema config for tsdb requires 24h index period
unrecognized schema version
Both boltdb-shipper and tsdb index stores are built around daily index tables, so their schema_config entries must set index.period: 24h. Loki also refuses to run when the schema version is too old for the chosen store (TSDB needs v13), when the store/object_store pair is inconsistent, or when two schema entries overlap on their from dates. Because schema changes are historical and permanent, the fix is almost always to add a new, future-dated entry rather than edit an existing one.
Symptoms
- Loki exits at startup with
invalid schema confignaming the 24h index period requirement. - Switching to TSDB surfaces
schema config for tsdb requires 24h index period. - A hand-edited or copied config reports
unrecognized schema version. - Queries for older data break after someone edited a historical schema entry in place.
- The config passes a YAML linter but fails Loki’s own semantic validation.
Common Root Causes
- Index period not 24h — a
boltdb-shipperortsdbschema entry setsindex.periodto something other than24h, which those stores reject. - Store / object_store mismatch — the
store(index) andobject_store(chunks) values are inconsistent with the schema, e.g.tsdbindex with a missing or wrong object store. - Schema version too old for the store — using
v11orv12where TSDB requiresv13, so validation fails. - Overlapping
fromdates — two schema entries whose date ranges overlap, leaving Loki unable to decide which applies. - Historical schema edited in place — changing an existing entry’s
from,store, orperiodorphans previously written data and can invalidate the config.
How to diagnose
-
Validate the schema offline so you see the exact rejection without crash-looping the cluster:
loki -config.file=/etc/loki/config.yaml -verify-config -
Capture the precise message from the logs, since 24h-period and version errors have different fixes:
kubectl logs -l app=loki --tail=30 | grep -i 'schema config' -
Review the current
schema_configand confirm each entry’s period, store, and version line up:schema_config: configs: - from: 2024-01-01 store: tsdb object_store: s3 schema: v13 index: prefix: index_ period: 24h -
Check for overlapping or out-of-order
fromdates across entries, which Loki treats as ambiguous:grep -n 'from:' /etc/loki/config.yaml -
Confirm the binary supports the schema version you are targeting before committing to
v13+tsdb:loki -version
Fixes
Set the index period to 24h on every boltdb-shipper and tsdb schema entry — this is the requirement the error names directly:
schema_config:
configs:
- from: 2024-01-01
store: boltdb-shipper
object_store: s3
schema: v12
index:
prefix: index_
period: 24h
Use the current store/schema combination for new setups: TSDB index, an object store for chunks, and schema v13. This is the recommended modern configuration:
schema_config:
configs:
- from: 2025-06-01
store: tsdb
object_store: s3
schema: v13
index:
prefix: index_
period: 24h
Add a new schema entry with a future from date instead of editing the old one. Loki applies each entry to data written on or after its from, so migrations are additive:
schema_config:
configs:
- from: 2024-01-01 # existing data — leave untouched
store: boltdb-shipper
object_store: s3
schema: v12
index: { prefix: index_, period: 24h }
- from: 2025-07-15 # future date — new writes use TSDB v13
store: tsdb
object_store: s3
schema: v13
index: { prefix: tsdb_index_, period: 24h }
Align store and object_store with matching storage_config blocks so the index and chunk backends actually exist for the version you name:
storage_config:
tsdb_shipper:
active_index_directory: /loki/tsdb-index
cache_location: /loki/tsdb-cache
aws:
s3: s3://region/loki-chunks
Never change a historical schema in place — set the new entry’s from to a date strictly after your last one, so old tables keep resolving under their original schema.
What to watch out for
boltdb-shipperandtsdbboth mandate a24hindex period; any other value fails validation, so do not copy a legacy non-shipper period.- Schema entries are permanent history — editing an existing
from,store, orperiodcan make already-written data unqueryable. - Always give a migration entry a
fromdate in the future (or at least after the last entry) to avoid overlap errors. - TSDB requires schema
v13; pairing it withv11/v12triggersunrecognized schema versionor a validation failure. - Keep
object_storeconsistent with a realstorage_configbackend — a schema that namess3needs a configured S3 block, or chunks have nowhere to go.
Related
- Loki Error Guide: ‘the query time range exceeds the limit’ — query bounds that interact with how index periods shard your data.
- Loki Error Guide: ‘too many chunks to fetch’ — read-path pressure often traced back to index and schema layout.
- Loki Error Guide: ‘failed to flush chunks’ — the write-path failure that follows a store/schema mismatch.
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.