How do you configure Prometheus retention?
BeginnerConceptPrometheus Architecture
Answer
With command-line flags:
prometheus --storage.tsdb.path=/prometheus \
--storage.tsdb.retention.time=15d \
--storage.tsdb.retention.size=200GB
Default is 15 days. If both are set, whichever hits first wins. Retention deletes whole blocks, so actual data kept can slightly exceed the target. For months or years we use remote storage (Thanos, Mimir, Cortex, VictoriaMetrics), not a bigger local disk.
More on Prometheus Architecture
Describe the Prometheus architecture.BeginnerWhat does a basic prometheus.yml look like?BeginnerWhat is the `up` metric?BeginnerWhat are `job` and `instance` labels and where do they come from?BeginnerHow is the Prometheus TSDB organized on disk?AdvancedWhat is the WAL and why does Prometheus restart slowly sometimes?Advanced