src/rgw/setup/rgw.py
def _logrotate_generic(conf: MappedConf):
        """ Configure logrotate utility for rgw logs."""
        log_file_path = Rgw._get_log_dir_path(conf)
        # Configure the cron job on hourly frequency for RGW log files.
        try:
            with open(const.CRON_LOGROTATE_TMPL, 'r') as f:
                content = f.read()
            with open(const.CRON_LOGROTATE, 'w') as f:
                f.write(content)
        except Exception as e:
            Log.error(f"Failed to configure cron job for logrotate at {const.FREQUENCY} basis."
                      f"ERROR:{e}")
        # create radosgw logrotate file.
        # For eg:
        # filepath='/etc/logrotate.d/radosgw'
        old_file = os.path.join(const.LOGROTATE_DIR, 'ceph')
        if os.path.exists(old_file):
            os.remove(old_file)
        try:
            with open(const.LOGROTATE_TMPL, 'r') as f:
                content = f.read()
            content = content.replace('TMP_LOG_PATH', log_file_path)
            with open(const.LOGROTATE_CONF, 'w') as f:
                f.write(content)
            Log.info(f'{const.LOGROTATE_TMPL} file copied to {const.LOGROTATE_CONF}')
        except Exception as e:
            Log.error(f"Failed to configure logrotate for {const.COMPONENT_NAME}. ERROR:{e}")
        # start cron.d service
        try:
            os.system(f"chmod +x {const.CRON_LOGROTATE}")
            os.system("/usr/sbin/crond start")
        except Exception as e:
            Log.error(f"Failed to start the crond service for {const.COMPONENT_NAME}. ERROR:{e}")
 Configure logrotate utility for rgw logs.
Configure logrotate utility for rgw logs.
Configure logrotate utility for rgw logs .
def _logrotate_generic(conf: MappedConf):
        log_file_path = Rgw._get_log_dir_path(conf)
        try:
            with open(const.CRON_LOGROTATE_TMPL, 'r') as f:
                content = f.read()
            with open(const.CRON_LOGROTATE, 'w') as f:
                f.write(content)
        except Exception as e:
            Log.error(f"Failed to configure cron job for logrotate at {const.FREQUENCY} basis."
                      f"ERROR:{e}")
        old_file = os.path.join(const.LOGROTATE_DIR, 'ceph')
        if os.path.exists(old_file):
            os.remove(old_file)
        try:
            with open(const.LOGROTATE_TMPL, 'r') as f:
                content = f.read()
            content = content.replace('TMP_LOG_PATH', log_file_path)
            with open(const.LOGROTATE_CONF, 'w') as f:
                f.write(content)
            Log.info(f'{const.LOGROTATE_TMPL} file copied to {const.LOGROTATE_CONF}')
        except Exception as e:
            Log.error(f"Failed to configure logrotate for {const.COMPONENT_NAME}. ERROR:{e}")
        try:
            os.system(f"chmod +x {const.CRON_LOGROTATE}")
            os.system("/usr/sbin/crond start")
        except Exception as e:
            Log.error(f"Failed to start the crond service for {const.COMPONENT_NAME}. ERROR:{e}")
def _logrotate_generic ( conf : MappedConf ) : log_file_path = Rgw . _get_log_dir_path ( conf ) try : with open ( const . CRON_LOGROTATE_TMPL , 'r' ) as f : content = f . read ( ) with open ( const . CRON_LOGROTATE , 'w' ) as f : f . write ( content ) except Exception as e : Log . error ( f"Failed to configure cron job for logrotate at {const.FREQUENCY} basis." f"ERROR:{e}" ) old_file = os . path . join ( const . LOGROTATE_DIR , 'ceph' ) if os . path . exists ( old_file ) : os . remove ( old_file ) try : with open ( const . LOGROTATE_TMPL , 'r' ) as f : content = f . read ( ) content = content . replace ( 'TMP_LOG_PATH' , log_file_path ) with open ( const . LOGROTATE_CONF , 'w' ) as f : f . write ( content ) Log . info ( f'{const.LOGROTATE_TMPL} file copied to {const.LOGROTATE_CONF}' ) except Exception as e : Log . error ( f"Failed to configure logrotate for {const.COMPONENT_NAME}. ERROR:{e}" ) try : os . system ( f"chmod +x {const.CRON_LOGROTATE}" ) os . system ( "/usr/sbin/crond start" ) except Exception as e : Log . error ( f"Failed to start the crond service for {const.COMPONENT_NAME}. ERROR:{e}" )
Configure logrotate utility for rgw logs.
Configure logrotate utility for rgw logs .
""" Configure logrotate utility for rgw logs.""" # Configure the cron job on hourly frequency for RGW log files. # create radosgw logrotate file. # For eg: # filepath='/etc/logrotate.d/radosgw' # start cron.d service
conf
MappedConf