Skip to content

fix: enable limit total number of log files#1

Merged
bohutang merged 1 commit intomainfrom
dev-max-files
Mar 20, 2025
Merged

fix: enable limit total number of log files#1
bohutang merged 1 commit intomainfrom
dev-max-files

Conversation

@bohutang
Copy link

Problem

Previously, when using hourly log rotation, the system would count each date separately. For example:

  • databend-query-default.2025-03-18-10.log
  • databend-query-default.2025-03-18-11.log
  • databend-query-default.2025-03-19-09.log
  • databend-query-default.2025-03-19-10.log

These were treated as different groups, allowing up to 48 files for EACH date. This caused excessive accumulation - in one case, we found 458 log files when the limit was supposed to be 48.

Solution

  • Modified the code to recognize that databend-query-default is the common base prefix
  • Updated cleanup logic to count all related files together regardless of date/hour
  • Added tests that simulate multiple date patterns with hourly rotation

Impact

The system now correctly keeps only the maximum allowed number of log files (e.g., 48) total, even when they have different dates and hours in their names. This prevents disk space issues from log file buildup over multiple days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant