Skip to content

Commit

Permalink
Merge pull request #478 from gbregman/devel
Browse files Browse the repository at this point in the history
Increase the number of log file backup directories and add the limit to the conf file
  • Loading branch information
gbregman authored Mar 5, 2024
2 parents dfb7bdf + e54d9b6 commit 2050a76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions ceph-nvmeof.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bdevs_per_cluster = 32
#verbose_log_messages = True
#max_log_file_size_in_mb=10
#max_log_files_count=20
#max_log_directory_backups=10
#
# Notice that if you change the log directory the log files will only be visible inside the container
#
Expand Down
5 changes: 4 additions & 1 deletion control/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ class GatewayLogger:
CEPH_LOG_DIRECTORY = "/var/log/ceph/"
MAX_LOG_FILE_SIZE_DEFAULT = 10
MAX_LOG_FILES_COUNT_DEFAULT = 20
MAX_LOG_DIRECTORY_BACKUPS_DEFAULT = 10
NVME_LOG_DIR_PREFIX = "nvmeof-"
NVME_LOG_FILE_NAME = "nvmeof-log"
logger = None
Expand Down Expand Up @@ -212,19 +213,21 @@ def __init__(self, config=None):
log_files_rotation_enabled = config.getboolean_with_default("gateway", "log_files_rotation_enabled", True)
max_log_file_size = config.getint_with_default("gateway", "max_log_file_size_in_mb", GatewayLogger.MAX_LOG_FILE_SIZE_DEFAULT)
max_log_files_count = config.getint_with_default("gateway", "max_log_files_count", GatewayLogger.MAX_LOG_FILES_COUNT_DEFAULT)
max_log_directory_backups = config.getint_with_default("gateway", "max_log_directory_backups", GatewayLogger.MAX_LOG_DIRECTORY_BACKUPS_DEFAULT)
log_level = config.get_with_default("gateway", "log_level", "info")
else:
verbose = True
log_files_enabled = False
log_files_rotation_enabled = False
max_log_file_size = GatewayLogger.MAX_LOG_FILE_SIZE_DEFAULT
max_log_files_count = GatewayLogger.MAX_LOG_FILES_COUNT_DEFAULT
max_log_directory_backups = GatewayLogger.MAX_LOG_DIRECTORY_BACKUPS_DEFAULT
log_level = "info"

self.handler = None
logdir_ok = False
if log_files_enabled:
GatewayLogger.rotate_backup_directories(self.log_directory, 5)
GatewayLogger.rotate_backup_directories(self.log_directory, max_log_directory_backups)
if not log_files_rotation_enabled:
max_log_file_size = 0
max_log_files_count = 0
Expand Down

0 comments on commit 2050a76

Please sign in to comment.