Retention Policy - Dashboard Prometheus

Hi @memorist23 ,

Therese several options in the prometheus.service file, in my snippet there’s using EnvironmentFile, but in your snippet, no need to have EnvironmentFile, just add the retention config

In my config, I use this as EnvironmentFile

In your config, just use this

[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target 

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.listen-address=0.0.0.0:9090 \
--web.console.libraries=/etc/prometheus/console_libraries \
--storage.tsdb.retention.time=2y

[Install]
WantedBy=multi-user.target

[/quote]

Then your retention time goes to 2y

Regards,
Fadjar Tandabawana

1 Like