This topic describes the parameters that you can use to configure the retention strategy for OceanBase Database operation logs and the global log retention strategy for OceanBase Cloud Platform (OCP).
Configure the retention strategy for OceanBase Database operation logs
You can configure the retention strategy of system operation logs for OceanBase Database by specifying the enable_syslog_recycle and max_syslog_file_count parameters.
| Parameter | Description | Restart required |
|---|---|---|
enable_syslog_recycle |
Specifies whether to enable automatic log cleanup. Default value: False, which means that automatic log cleanup is disabled. |
No |
max_syslog_file_count |
The number of retained log files. Default value: 0, which means that the number of log files is not limited. Each log file can be at most 256 MB in size. You can specify a smaller value to save disk space. max_syslog_file_count parameter independently controls the number of log files of each type. If you have set this parameter to a large value and enabled end-to-end diagnostics, your log disk is likely to be fully occupied.max_syslog_file_count parameter specifies the total number of all log files that can be retained, regardless of the types. |
No |
Note
If a great number of trace.log files are generated in a short period of time, they may occupy too much disk space, leading to early cleanup of OceanBase Database operation logs. We recommend that you adjust the level of end-to-end diagnostics to keep an appropriate amount of the trace.log files.
Configure the global log retention strategy for OCP
OCP uses log-cleaner to automatically clean up the system operation logs of OceanBase Database. You can enable or disable log-cleaner by specifying the ocp.agent.ob.log-cleaner.enabled parameter. When log-cleaner is enabled, it clears log files based on the following rules:
- The logs are not cleared when the log disk usage is less than the threshold, which is 80% by default.
- If the log disk usage exceeds the threshold, log-cleaner first clears logs that were generated before the specified time.
- If the log disk usage drops below the threshold after the time-based log cleanup, log-cleaner stops.
- If the log disk usage is still greater than the threshold after the time-based log cleanup, log-cleaner deletes log files based on the retention percentage.
The following table describes the parameters that you can use to configure the log cleanup strategies. To modify these parameters, choose System Management > System Parameters.
| Parameter | Description | Restart required |
|---|---|---|
ocp.agent.ob.log-cleaner.enabled |
Specifies whether to enable log-cleaner. Default value: true, which indicates that automatic log cleanup is enabled. log-cleaner is enabled after an OceanBase cluster is created and cluster configurations are delivered to and take effect in OCP Agent. |
No |
ocp.agent.ob.log-cleaner.config |
Settings of log-cleaner. disk_threshold: the disk usage threshold for triggering log cleanup. Default value: 80.file_reg: the rule for matching log file names. You can specify the names of the log files to be cleared. By default, the following log files will be cleared:
retention_days: the log retention days. Default value: 30.keep_percentage: the percentage of log files to be retained. Default value: 80. If the remaining log files still exceed the disk usage threshold after log cleanup based on the retention_days setting, most recent logs are retained based on the specified percentage. |
No |
ocp.agent.ob.log-cleaner.run.internal |
The interval for running log-leaner. Default value: 5 minutes. | No |