OneStopList

Gods and goddesses

Prometheus Storage Duration: How Long Data Lasts

Updated November 20, 2026

Prometheus does not store data for a fixed amount of time; the retention period is entirely configurable, with a default of 15 days. After that period, data is deleted unless you explicitly change the retention settings or use an external storage system.

What Prometheus Storage Actually Is

Prometheus is a time-series database designed for monitoring and alerting. It scrapes metrics from targets (applications, servers, databases) and stores them locally on disk in a custom format. This local storage is efficient but ephemeral by design—it is not meant to be a long-term archival system. The default retention of 15 days balances disk usage with operational needs, but many users extend it to months or redirect data to external stores for longer history.

How Retention Is Configured

Retention is set at startup via command-line flags. The two main flags are:

  • --storage.tsdb.retention.time: how long to keep samples (e.g., 30d, 12h, 1y).
  • --storage.tsdb.retention.size: maximum disk space the database may use (e.g., 50GB). When either limit is exceeded, old data is removed.

You can also set a minimum retention for specific data using --storage.tsdb.retention.min-time and a maximum with --storage.tsdb.retention.max-time (useful for downsampling). If both time and size are set, data is deleted when either threshold is reached.

Default Values and Practical Ranges

Out of the box, Prometheus keeps 15 days of data. This is a conservative default that works for many use cases, but it is common to see production deployments with 30, 60, or even 90 days of retention. The maximum practical retention depends on your disk speed and capacity. Prometheus compresses samples efficiently—roughly 1.3 bytes per sample on average—so a server collecting 100,000 samples per second would use about 11 GB per day. At that rate, 15 days is ~165 GB, and 90 days would be ~1 TB.

What Happens When Data Expires

When the retention period passes, Prometheus deletes the old blocks of data. This is a background process that runs every hour. Deletion is permanent—there is no built-in recovery. If you need to keep data longer, you must either increase retention or export it. Prometheus also supports downsampling (via the --storage.tsdb.retention.time plus --storage.tsdb.retention.size and the --storage.tsdb.retention.min-time flag) to reduce resolution of older data, but this is experimental in some versions.

Extending Storage with External Systems

For long-term storage, the common approach is to use the Prometheus remote write protocol to send data to systems like Thanos, VictoriaMetrics, or Cortex. These tools store data in object storage (S3, GCS) or other databases, allowing retention for years. Prometheus itself then only keeps a short local buffer (e.g., 2 hours) for recent data, while the remote system holds the history. This is the standard architecture for large-scale monitoring.

How to Choose the Right Retention

Selecting a retention period depends on your needs:

  • Short (7-15 days): Enough for debugging recent incidents, with minimal disk usage.
  • Medium (30-90 days): Good for capacity planning and monthly trends.
  • Long (1 year+): Usually requires external storage; useful for compliance or annual comparisons.

Also consider the --storage.tsdb.retention.size flag to cap disk usage—this is often more predictable than time-based retention because it directly controls disk consumption.

Common Misconception: Data Is Not Stored in a Database

Many assume Prometheus uses a traditional SQL or NoSQL database. It does not—it has its own custom storage engine optimized for time-series. This engine writes data in blocks of 2 hours, which are then compacted into larger blocks. This design makes it fast for queries but means you cannot easily query data older than the retention period unless you use external tools.

Frequently Asked Questions

Can I set retention to unlimited? There is no “infinite” option, but you can set a very large time value (e.g., 100y) and a large size. However, disk will eventually fill, so it is not recommended.

Does Prometheus store data in memory or on disk? It uses both: recent data is in memory for fast querying, then flushed to disk in blocks. The retention flags control disk data; memory is not persistent across restarts.

What is the difference between retention.time and retention.size? Time deletes data older than a duration; size deletes data when the total disk usage exceeds a byte limit. You can set both; deletion happens when either is exceeded.

Can I recover deleted data? No, once blocks are removed, they are gone. If you need recovery, you must have external backups or use remote storage.

Does Prometheus support downsampling to save space? Yes, but it is not enabled by default. You can use the --storage.tsdb.retention.time and --storage.tsdb.retention.size flags together with the --storage.tsdb.retention.min-time to set a range for downsampling, but this feature is still considered experimental in many versions.

Is 15 days enough for my use case? It depends. For basic monitoring, yes. For auditing or trend analysis over months, you will likely need to increase retention or use external storage like Thanos.

Related

How pages are sourced and corrected: Sources and editorial policy.