Elasticsearch Index Management#
Jaeger's Elasticsearch/OpenSearch storage backend supports four index lifecycle strategies :
| Strategy | Config variant | External tooling required |
|---|---|---|
| Time-based (default) | periodic | jaeger-es-index-cleaner cron |
| Manual rollover | manual_rollover | jaeger-es-rollover init + rollover/lookback crons + index-cleaner |
| Rollover with ILM/ISM | auto_rollover | jaeger-es-rollover init |
| Native data streams | data_stream | None (experimental โ RFC 0004) |
The active strategy is set per-index-type (spans, services, dependencies, sampling) under elasticsearch.indices.<type>.rotation. Services and dependencies indices cannot use data_stream because they require upserts .
indices.<type>.rotation Config Schema#
Introduced in PR #8823 (Phase 1b of RFC 0004) as a replacement for the legacy use_aliases / use_ilm boolean flags. The schema is defined in config_rotation.go with one RotationConfig variant per strategy.
Legacy Flags (Deprecated โ Now Errors by Default)#
As of PR #9018, two feature gates were promoted from Alpha to Beta (enabled by default):
| Gate | Behavior |
|---|---|
jaeger.es.config.rejectLegacyRotationFlags | Legacy flags (use_aliases, use_ilm, alias names) cause a validation error at startup; disable with --feature-gates=-jaeger.es.config.rejectLegacyRotationFlags to temporarily opt out while migrating |
jaeger.es.index.relativeTimeIndexDeletion | es-index-cleaner deletes relative to current time instead of tomorrow midnight |
Legacy IDs (es.config.*, es.index.*) remain as deprecated aliases after gate-name normalization in PR #9037.
jaeger-es-index-cleaner#
CLI cron job that deletes Jaeger indices older than a configurable number of days. Entry point: cmd/es-index-cleaner/main.go.
Usage: jaeger-es-index-cleaner NUM_OF_DAYS http://HOSTNAME:PORT
Deletion is a two-stage pipeline in index_filter.go : regex pattern match โ date filter. Indices referenced by a write alias are always excluded .
| Mode | Flag | Targets |
|---|---|---|
| Date-based (default) | (none) | jaeger-(span|service|...)-YYYY-MM-DD |
| Rollover | --rollover | jaeger-(span|service|...)-NNNNNN |
| Archive | --archive | jaeger-span-archive-NNNNNN |
โ ๏ธ Known bug:
--index-date-separator(default-) is interpolated into the regex without escaping. Using.as a separator causes the dot to act as a wildcard, potentially matching unintended indices (Issue #9120) .
jaeger-es-rollover#
Manages alias-based index rotation for manual_rollover and auto_rollover strategies. Entry point: cmd/es-rollover/main.go.
Three subcommands :
initโ Creates initial indices, read/write aliases, and optionally an ILM policy. Run once before Jaeger starts.rolloverโ Triggers a write-alias rollover, creating a new backing index.lookbackโ Removes old indices from the read alias based on a configured lookback window.
lookback โ --unit and --unit-count Flags#
The lookback window is computed in time_reference.go using --unit (default: days) and --unit-count (default: 1). Valid units as of the current code: minutes, hours, days, weeks, months, years .
The computation in action.go is: fetch all Jaeger indices โ filter to the read alias โ exclude the write-alias index โ filter by date cutoff โ remove from read alias.
โ ๏ธ Bug (open PR #9442): Before PR #9442, an unknown
--unitvalue (e.g.,dayinstead ofdays) silently fell through to adefaultcase computing the window in seconds, causing nearly all read-alias indices to be removed with no error. The fix makesgetTimeReferencereturn an error for unknown units and rejects the call before any Elasticsearch operation .
RFC 0004: Native Data Streams (Experimental)#
RFC 0004 proposes native ES/OpenSearch data streams as a data_stream rotation strategy. Requires ES 7.9+ or OpenSearch 2.0+ .
Key advantages :
- No initialization step โ first write auto-creates the stream
- No alias management โ stream name is both read and write target
- Built-in rollover via ILM/ISM; no external rollover cron needed
Data stream names use dot-notation (jaeger.spans). Jaeger creates three component templates on startup: mappings (@mappings), settings (@settings), and the composable index template itself. A <prefix>jaeger.spans@custom template is never overwritten, providing an operator customization hook .
The default lifecycle policy rolls over at 50 GB / 200M docs / 5 days and deletes at 7 days . A custom policy file can be supplied via data_stream.policy_file.
Implementation Status#
| Phase | Description | Status |
|---|---|---|
| 1a | Strategy interface refactoring | โ Complete |
| 1b | indices.rotation config schema | โ Complete โ PR #8823 |
| 2 | Data stream write path | ๐ฒ Pending |
| 3 | Migration support | ๐ฒ Pending |
| 4 | Docs and tool deprecation | ๐ฒ Pending |
โ ๏ธ Index discovery gap: The existing
GetJaegerIndiceswildcard (<prefix>jaeger-*) does not match dot-notation data stream names or their.ds-*backing indices. Index-cleaner, es-rollover, and integration test teardown will silently skip data streams until this is resolved .
Key Source Files#
| File | Purpose |
|---|---|
internal/storage/elasticsearch/config/config_rotation.go | RotationConfig and variant structs |
internal/storage/elasticsearch/config/config_legacy.go | Legacy flag definitions and rejectLegacyRotationFlags gate |
internal/storage/elasticsearch/indices/build.go | BuildRotation() โ constructs runtime Rotation from config |
cmd/es-index-cleaner/app/index_filter.go | Pattern-match and alias-exclusion logic for index deletion |
cmd/es-rollover/app/lookback/time_reference.go | Lookback window calculation (getTimeReference) |
cmd/es-rollover/app/lookback/action.go | Lookback orchestration โ fetch, filter, remove from read alias |
cmd/es-rollover/app/lookback/flags.go | --unit / --unit-count flag definitions |
docs/rfc/0004-elasticsearch-data-streams.md | Full design spec for native data streams |