feat: host log save into directory and compress log file add-ons file count use default value 300.

Signed-off-by: TaowerfulMAX <liurantao@huawei.com>
This commit is contained in:
TaowerfulMAX 2024-09-20 10:15:23 +08:00
parent 8f4cbffd93
commit bf35b74c83
2 changed files with 2 additions and 4 deletions

View File

@ -498,8 +498,7 @@ namespace Base {
}
// Sort file names by time, with newer ones coming first
sort(files.begin(), files.end(), CompareLogFileName);
uint64_t limitDirSize = (g_logLevel < LOG_DEBUG) ? NORMAL_LOG_DIR_SIZE : MAX_LOG_DIR_SIZE;
uint32_t deleteCount = GetLogOverCount(files, limitDirSize);
uint32_t deleteCount = GetLogOverCount(files, MAX_LOG_DIR_SIZE);
WRITE_LOG(LOG_INFO, "log file count: %u, logLimit: %u", files.size(), logLimitSize);
if (deleteCount == 0 || files.size() < deleteCount) {
return;

View File

@ -25,10 +25,9 @@ constexpr size_t SIZE_THREAD_POOL_MIN = 16;
constexpr size_t SIZE_THREAD_POOL_MAX = 256;
constexpr uint8_t GLOBAL_TIMEOUT = 30;
constexpr uint16_t DEFAULT_PORT = 8710;
constexpr uint16_t MAX_LOG_FILE_COUNT = 30;
constexpr uint16_t MAX_LOG_FILE_COUNT = 300;
constexpr uint64_t MAX_LOG_FILE_SIZE = static_cast<uint64_t>(100) * 1024 * 1024; // 100MB
constexpr uint64_t MAX_LOG_DIR_SIZE = static_cast<uint64_t>(3) * 1024 * 1024 * 1024; // 3GB
constexpr uint64_t NORMAL_LOG_DIR_SIZE = static_cast<uint64_t>(200) * 1024 * 1024; // 200MB
constexpr bool ENABLE_IO_CHECKSUM = false;
const string IPV4_MAPPING_PREFIX = "::ffff:";
const string DEFAULT_SERVER_ADDR_IP = "::ffff:127.0.0.1";