feat: Add configuration flag --log-retention-days#3862
Merged
Conversation
Contributor
Author
Tracking
Standard development
CI Testing Labels
Documentation checklist
|
Josipmrden
approved these changes
Mar 4, 2026
andrejtonev
approved these changes
Mar 4, 2026
11 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 5, 2026
## What Introduces a new `--log-retention-days` configuration flag that controls how many days daily log files are preserved. The previously hard-coded retention count of 35 is now a user-configurable `gflags` parameter with a validated range of 1–max(uint16_t) ## Why Log retention was hard-coded to 35 days with no way to adjust it at runtime or deployment time. Users running Memgraph in environments with stricter storage constraints or compliance requirements had no control over how long log files were kept. ## How - Replaced the `inline constexpr auto log_retention_count = 35` constant in `src/flags/logging.cpp` with a `DEFINE_VALIDATED_uint64(log_retention_days, ...)` flag - The `daily_file_sink_st` constructor call now uses `FLAGS_log_retention_days` instead of the old constant. - Minor reformatting of the `DEFINE_VALIDATED_string` for `logger_type` (namespace qualification of `utils::ToLowerCase` → `memgraph::utils::ToLowerCase` since the flag definition sits outside `namespace memgraph::flags`). ## Testing - Updated `tests/e2e/configuration/default_config.py` to include `log_retention_days` with its expected default value (`"35"`), ensuring the default-config e2e test validates the new flag. - No new unit tests added — the flag uses `DEFINE_VALIDATED_uint64` with `FLAG_IN_RANGE`, which is a well-tested gflags validation macro, and the downstream behaviour (spdlog daily sink retention) is third-party code.
|
68 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Introduces a new
--log-retention-daysconfiguration flag that controls how many days daily log files are preserved. The previously hard-coded retention count of 35 is now auser-configurable
gflagsparameter with a validated range of 1–max(uint16_t)Why
Log retention was hard-coded to 35 days with no way to adjust it at runtime or deployment time. Users running Memgraph in environments with stricter storage constraints or
compliance requirements had no control over how long log files were kept.
How
inline constexpr auto log_retention_count = 35constant insrc/flags/logging.cppwith aDEFINE_VALIDATED_uint64(log_retention_days, ...)flagdaily_file_sink_stconstructor call now usesFLAGS_log_retention_daysinstead of the old constant.DEFINE_VALIDATED_stringforlogger_type(namespace qualification ofutils::ToLowerCase→memgraph::utils::ToLowerCasesince the flagdefinition sits outside
namespace memgraph::flags).Testing
tests/e2e/configuration/default_config.pyto includelog_retention_dayswith its expected default value ("35"), ensuring the default-config e2e test validates thenew flag.
DEFINE_VALIDATED_uint64withFLAG_IN_RANGE, which is a well-tested gflags validation macro, and the downstream behaviour (spdlogdaily sink retention) is third-party code.