Note
This parameter is available starting with V1.4.
Description
max_syslog_file_count specifies the maximum number of log files that can be retained before they are recycled.
Note
Each log file can occupy up to 256 MB of disk space.
Attributes
| Attribute | Description |
|---|---|
| Parameter type | INT |
| Default value | 0, which indicates that no log files are deleted. |
| Value range | [0, +∞) |
| Modifiable | Yes. You can use the ALTER SYSTEM SET statement to modify the parameter. |
| Effective upon OBServer node restart | No. The setting takes effect immediately. |
Considerations
The total number of log files of all types cannot exceed
max_syslog_file_count. Log files are recycled in a FIFO (first-in, first-out) manner. The FIFO strategy selects the log file based on the last modification time of the log file. For example, the log filexxxxxxxx.log.20231123223441234is sorted based on its end time to determine the order of recycling.The number of log files retained is limited by
max_syslog_file_count. The total number ofxxxxxx.log.xxxxxfiles after rotation cannot exceedmax_syslog_file_count, and the total number ofxxxxxx.log.wf.xxxxxfiles after rotation also cannot exceedmax_syslog_file_count. Note that the number of active log files (such as observer.log and rootservice.log) and their corresponding WF files is not counted in this limit.If trace logs are generated too quickly and in large quantities, they may occupy the space of OBServer log files, leading to the early recycling of OBServer logs. In this case, we recommend that you adjust the trace log level to determine an appropriate log volume. For more information about the trace log level, see Trace log level.
The relationship between the
max_syslog_file_countparameter and the syslog_disk_size parameter is as follows:max_syslog_file_count=0andsyslog_disk_size=0: No logs are recycled until the disk is full.max_syslog_file_count=0andsyslog_disk_size>0: When the total size of logs approachessyslog_disk_size, the oldest log files are deleted to recycle space.max_syslog_file_count>0andsyslog_disk_size=0: When the number of log files of a certain type exceedsmax_syslog_file_count, the oldest log files are deleted to recycle space.max_syslog_file_count>0andsyslog_disk_size>0: When the number of log files of a certain type exceedsmax_syslog_file_count, or when the total size of logs approachessyslog_disk_size, the oldest compressed files are deleted to recycle space.
Examples
Set the maximum number of log files that can be retained before they are recycled to 20.
obclient> ALTER SYSTEM SET max_syslog_file_count=20;