diff --git a/src/ServiceControl/Infrastructure/Settings/Settings.cs b/src/ServiceControl/Infrastructure/Settings/Settings.cs index 41b936916e..98c4f03f0b 100644 --- a/src/ServiceControl/Infrastructure/Settings/Settings.cs +++ b/src/ServiceControl/Infrastructure/Settings/Settings.cs @@ -259,6 +259,21 @@ private TimeSpan GetEventRetentionPeriod() TimeSpan result; if (TimeSpan.TryParse(valueRead, out result)) { + string message; + if (result < TimeSpan.FromHours(1)) + { + message = "EventRetentionPeriod settings is invalid, value should be minimum 1 hour."; + logger.Fatal(message); + throw new Exception(message); + } + + if (result > TimeSpan.FromDays(200)) + { + message = "EventRetentionPeriod settings is invalid, value should be maximum 200 days."; + logger.Fatal(message); + throw new Exception(message); + } + return result; } }