Is there a way to specify storage.tsdb.retention flag in the config file rather than pass on the command line? I have different configuration files for different situations and it would be easier to manage if I can specify storage.tsdb.retention in the config file too.
Prometheus stores its on-disk time series data under the directory specified by the flag storage. local. path . The default path is ./data (relative to the working directory), which is good to try something out quickly but most likely not what you want for actual operations.
By default the retention is configured to 15 days. The amounts of data stored on disk depends on retention — higher retention means more data on disk. The lowest supported retention in Prometheus is 2 hours (2h). Such a retention could be useful when configuring remote storage for Prometheus.
tsdb. max-block-duration flags need to be set to the same value (two hours to match the default behavior), so that Prometheus local compaction is disabled.
There is no way to specify retention time except on the command line. Consider using envdir to have a config on the file system that can inject a value for retention time (via an environment variable) from on-disk configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With