A large number of log files may be generated during the running of OceanBase Database. You can control the number of log files to avoid occupying all the storage space on disks.
The max_syslog_file_count parameter specifies the maximum number of log files allowed. After you set this parameter, OceanBase Database controls the number of recent log files of each type based on the log file type and archive time.
If you set the
max_syslog_file_countparameter to0, the observer process does not control the number of log files.If you set the
max_syslog_file_countparameter to a positive value, the observer process will limit the number of recent log files of each type to the specified value. For example, if you set themax_syslog_file_countparameter to100, the observer process limits the number of recent log files of each of the following types to100:observer.log,observer.log.wf,election.log,election.log.wf,rootservice.log, androotservice.log.wf. Take theobserver.logtype as an example:- When the number of log files is smaller than 100, the number of log files will accumulate until 100. Then, the earliest generated log file will be deleted each time a new log file is generated.
- When the number of log files is greater than or equal to 100, the number of recent log files keeps at 100. The earliest generated log file will be deleted each time a new log file is generated.
Procedure:
Set the
max_syslog_file_countparameter in one of the following ways.Set
max_syslog_file_countwhen the OBServer is running.The following example shows how to set
max_syslog_file_counton a client:
obclient > ALTER SYSTEM SET max_syslog_file_count=20;
* Set `max_syslog_file_count` in the `-o` option when you start an OBServer. The following example shows how to set `max_syslog_file_count` in `-o` when you start an OBServer: ```sql [admin@hostname oceanbase]$ /home/admin/oceanbase/bin/observer -i eth0 -P XXXX -p YYYY -z zone1 -d /home/admin/oceanbase/store/obdemo -r 'xxx.xxx.xxx.xxx:xxxx:xxx.xxx.xxx.xxx:xxxx xxx.xxx.xxx.xxx:xxxx:yyyy' -c 20190716 -n obdemo -o "max_syslog_file_count=20,memory_limit_percentage=90,memstore_limit_percentage=60,datafile_disk_percentage=80,config_additional_dir=/data/1/obdemo/etc3;/data/log1/obdemo/etc2"For more information, see Stop or start OBServer.
(Optional) Enable automatic log file recycling.
After this feature is enabled, when OceanBase Database is restarted, recent log files are retained for each log type based on the value of
max_syslog_file_count, and other log files are recycled.obclient > ALTER SYSTEM SET enable_syslog_recycle='True';
Description
The automatic log file recycling feature takes effect only when max_syslog_file_count is set to a positive value. For more information about the max_syslog_file_count and enable_syslog_recycle parameters, see System parameters.