Make system log engine customizable via config.

This commit is contained in:
Maxim Akhmedov 2020-01-23 14:22:06 +03:00
parent a02b59f300
commit 86a7f1d97b

View File

@ -31,8 +31,15 @@ std::shared_ptr<TSystemLog> createSystemLog(
String database = config.getString(config_prefix + ".database", default_database_name); String database = config.getString(config_prefix + ".database", default_database_name);
String table = config.getString(config_prefix + ".table", default_table_name); String table = config.getString(config_prefix + ".table", default_table_name);
String engine;
if (config.has(config_prefix + ".custom_engine"))
engine = config.getString(config_prefix + ".custom_engine");
else
{
String partition_by = config.getString(config_prefix + ".partition_by", "toYYYYMM(event_date)"); String partition_by = config.getString(config_prefix + ".partition_by", "toYYYYMM(event_date)");
String engine = "ENGINE = MergeTree PARTITION BY (" + partition_by + ") ORDER BY (event_date, event_time)"; engine = "ENGINE = MergeTree PARTITION BY (" + partition_by + ") ORDER BY (event_date, event_time) SETTINGS index_granularity = 1024";
}
size_t flush_interval_milliseconds = config.getUInt64(config_prefix + ".flush_interval_milliseconds", DEFAULT_SYSTEM_LOG_FLUSH_INTERVAL_MILLISECONDS); size_t flush_interval_milliseconds = config.getUInt64(config_prefix + ".flush_interval_milliseconds", DEFAULT_SYSTEM_LOG_FLUSH_INTERVAL_MILLISECONDS);