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.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus Architecture