Users have had issues with logs from long running enclaves taking up tons of storage. We have a retention mechanism that automatically rotates logs after some time but currently it a) is only able to rotate logs weekly b) can not be configured.
These improvements will allow retention to be as granular as hourly and will allow users to configure the retention period (eg. 1hr, 2hr, 1day, 1week). To do this, a few changes need to happen. Most notably the way logs are stored and retrieved needs to change to support rotating log files hourly. Implementing this requires changes across a few components(LogsAggregator, LogsDatabaseClient, LogFileManager, cli, so I'll be making them incrementally.
[x] PR 1: Introduce LogFileLayout and PerWeekLogFileLayout and adjust LogFileManager and LogsDatabaseClient to use this for retrieving log file paths
[ ] PR 2: Make retention configurable via a CLI flag
[ ] PR 3: Implement PerHourFileLayout and swap storage format from PerWeekFileLayout to PerHourFileLayout
[ ] PR 4: Make LogsAggregator use LogFileLayout for determining storage format and set it to use PerHourFileLayout
This first PR sets the stage for this change by introducing a new interface called LogFileLayout and migrating the existing storage format to use it. Right now, knowledge about the log storage format is spread across several entities (LogsAggregator - to store, LogFileManager - to rotate logs, StreamLogsStrategy - to read logs). This interface consolidates knowledge of how logs are stored into one module that can be used by any entity doing operations that require retrieving log files from the filesystem. This will make the transition to a different storage format safer (only requires implementing + testing PerHourFileLayout module) and makes it easier to swap out the storage format in the future (eg. if even more granular retention is need) without breaking other entities.
Description
Log Retention Improvements:
Users have had issues with logs from long running enclaves taking up tons of storage. We have a retention mechanism that automatically rotates logs after some time but currently it a) is only able to rotate logs weekly b) can not be configured.
These improvements will allow retention to be as granular as hourly and will allow users to configure the retention period (eg.
1hr
,2hr
,1day
,1week
). To do this, a few changes need to happen. Most notably the way logs are stored and retrieved needs to change to support rotating log files hourly. Implementing this requires changes across a few components(LogsAggregator
,LogsDatabaseClient
,LogFileManager
, cli, so I'll be making them incrementally.LogFileLayout
andPerWeekLogFileLayout
and adjustLogFileManager
andLogsDatabaseClient
to use this for retrieving log file pathsPerHourFileLayout
and swap storage format fromPerWeekFileLayout
toPerHourFileLayout
[ ] PR 4: Make
LogsAggregator
useLogFileLayout
for determining storage format and set it to usePerHourFileLayout
This first PR sets the stage for this change by introducing a new interface called
LogFileLayout
and migrating the existing storage format to use it. Right now, knowledge about the log storage format is spread across several entities (LogsAggregator
- to store,LogFileManager
- to rotate logs,StreamLogsStrategy
- to read logs). This interface consolidates knowledge of how logs are stored into one module that can be used by any entity doing operations that require retrieving log files from the filesystem. This will make the transition to a different storage format safer (only requires implementing + testingPerHourFileLayout
module) and makes it easier to swap out the storage format in the future (eg. if even more granular retention is need) without breaking other entities.Is this change user facing?
NO
References
https://github.com/kurtosis-tech/kurtosis/issues/2443 https://github.com/kurtosis-tech/kurtosis/issues/2190