| | | 1 | | namespace Elsa.Diagnostics.StructuredLogs.Options; |
| | | 2 | | |
| | | 3 | | public class StructuredLogsOptions |
| | | 4 | | { |
| | 103 | 5 | | public int RecentLogCapacity { get; set; } = 5_000; |
| | 64 | 6 | | public int SubscriberChannelCapacity { get; set; } = 1_000; |
| | | 7 | | /// <summary> |
| | | 8 | | /// Default <c>Take</c> and upper clamp for recent-log queries on every <c>IStructuredLogStore</c> implementation. |
| | | 9 | | /// Negative values are treated as zero so query construction never throws. |
| | | 10 | | /// </summary> |
| | 135 | 11 | | public int MaxRecentLogQuerySize { get; set; } = 1_000; |
| | 92 | 12 | | public TimeSpan SourceHeartbeatTimeout { get; set; } = TimeSpan.FromSeconds(30); |
| | 8 | 13 | | public bool IncludeStructuredLogsInternalLogs { get; set; } |
| | | 14 | | |
| | 12 | 15 | | public ICollection<string> SensitiveNames { get; set; } = |
| | 49 | 16 | | [ |
| | 49 | 17 | | "authorization", |
| | 49 | 18 | | "token", |
| | 49 | 19 | | "password", |
| | 49 | 20 | | "secret", |
| | 49 | 21 | | "api-key", |
| | 49 | 22 | | "apikey", |
| | 49 | 23 | | "cookie", |
| | 49 | 24 | | "connection-string", |
| | 49 | 25 | | "connectionstring" |
| | 49 | 26 | | ]; |
| | | 27 | | |
| | 12 | 28 | | public ICollection<string> SensitiveTextPatterns { get; set; } = |
| | 49 | 29 | | [ |
| | 49 | 30 | | "(?i)bearer\\s+[A-Za-z0-9._~+/=-]+", |
| | 49 | 31 | | "(?i)(password|secret|token|api[-_]?key)\\s*[=:]\\s*[^\\s,;]+", |
| | 49 | 32 | | "(?i)(AccountKey|SharedAccessKey)=([^;\\s]+)" |
| | 49 | 33 | | ]; |
| | | 34 | | |
| | | 35 | | public int ClampRecentLogQueryTake(int? take) |
| | | 36 | | { |
| | 47 | 37 | | var maxTake = Math.Max(0, MaxRecentLogQuerySize); |
| | 47 | 38 | | return Math.Clamp(take ?? maxTake, 0, maxTake); |
| | | 39 | | } |
| | | 40 | | } |