Svecco commented on code in PR #2452:
URL: https://github.com/apache/iggy/pull/2452#discussion_r2636796549
##########
core/server/src/log/logger.rs:
##########
@@ -253,8 +255,48 @@ impl Logging {
let base_directory = PathBuf::from(base_directory);
let logs_subdirectory = PathBuf::from(config.path.clone());
let logs_path = base_directory.join(logs_subdirectory.clone());
- let file_appender =
- tracing_appender::rolling::hourly(logs_path.clone(),
IGGY_LOG_FILE_PREFIX);
+
+ if let Err(e) = std::fs::create_dir_all(&logs_path) {
+ tracing::warn!("Failed to create logs directory {:?}: {}",
logs_path, e);
+ return Err(LogError::FileReloadFailure);
+ }
+
+ // Check available disk space (at least 10MB)
+ let min_disk_space: u64 = 10 * 1024 * 1024; // 10MB
+ if let Ok(available_space) = fs2::available_space(&logs_path) {
+ if available_space < min_disk_space {
+ tracing::warn!(
+ "Low disk space for logs. Available: {} bytes,
Recommended: {} bytes",
+ available_space,
+ min_disk_space
+ );
+ }
+ } else {
+ tracing::warn!(
+ "Failed to check available disk space for logs directory:
{:?}",
+ logs_path
+ );
+ }
+
+ let max_files = Self::calculate_max_files(
+ config.max_size.as_bytes_u64(),
+ config.max_size.as_bytes_u64(),
Review Comment:
Sorry, this was a typo :( ~~and I also overlooked this later~~. It has now
been updated to user configurable maximum size of a single log file and total
maximum size.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]