OceanBase AI Database supports system log compression, with a compression ratio of 15 to 20 times.
Compression reduces the size of log files, saves disk space, and facilitates transmission and storage. Decompression restores compressed log files to their original readable format, facilitating log viewing and analysis.
Log compression
To control system log compression, perform the following steps:
Enable system log compression.
After system log compression is enabled, the
observer.log,rootservice.log,election.log, andtrace.logfiles suffixed with a timestamp are compressed, and those suffixed with.wfare not compressed. You can specify a compression algorithm by using thesyslog_compress_funcconfiguration item to enable system log compression. Supported algorithms arezstd_1.0andzstd_1.3.8. For example, you can set the system log compression algorithm tozstd_1.3.8. For more information aboutsyslog_compress_func, see syslog_compress_func.obclient> ALTER SYSTEM SET syslog_compress_func = 'zstd_1.3.8';Set the disk space available for system logs.
When the total size of system logs is about to reach the specified upper limit, log files are deleted from the oldest ones, including those that are compressed. You can specify the
syslog_disk_sizeconfiguration item to set the maximum disk space available for system logs. For example, you can set it to 100 GB. For more information aboutsyslog_disk_size, see syslog_disk_size.Note
The actual disk space is subject to the hardware specifications and actual requirements. If you want system logs to occupy the entire disk, you can set the value to 0 GB.
obclient> ALTER SYSTEM SET syslog_disk_size='100GB';Set the number of uncompressed log files. You can control the minimum number of uncompressed files of each log type to facilitate problem analysis based on logs. In practice, the number of uncompressed files can exceed the specified value but will not be smaller than this value. You can specify the
syslog_file_uncompressed_countconfiguration item to set the number of uncompressed system log files. For example, you can set it to 50. For more information aboutsyslog_file_uncompressed_count, see syslog_file_uncompressed_count.Note
Set the value based on actual requirements. For example, if you set the value to 50, a total of 200 system log files are not compressed for the four log types, and the total size is about 50 GB (256 MB × 200).
obclient> ALTER SYSTEM SET syslog_file_uncompressed_count=50;
Log decompression
You can view compressed log files by using either of the following tools:
Use the zstd tool.
Install the zstd tool.
Download the zstd tool from the official zstd website.
Use the zstd tool to decompress files.
Decompress a file and then view its content.
Run the
zstd -d xxx.zstcommand to decompress the file. In the command,xxx.zstindicates the name of the file to be decompressed.Run the
vim xxxcommand to view the file content. In the command,xxxindicates the name of the decompressed file.
Directly view the content of the compressed file.
Run the
zstd -dc xxx.zstcommand to directly view the content of the compressed file. In the command,xxx.zstindicates the name of the compressed file.
Use the obdiag tool.
Install the obdiag tool.
For information about how to install obdiag, see Install obdiag.
Use the obdiag tool to decompress files.
Run the
obdiag gather log [options]command to search for compressed log files. For more information about obdiag, see obdiag gather log.