mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Support configure Ssystem log table's ttl in config.xml
This commit is contained in:
parent
747453b008
commit
4cc6594cb8
@ -589,6 +589,9 @@
|
||||
toStartOfHour(event_time)
|
||||
-->
|
||||
<partition_by>toYYYYMM(event_date)</partition_by>
|
||||
<!-- How many days data would be kept. It works only when this option is opened and is set greater than 0.
|
||||
-->
|
||||
<ttl>30</ttl>
|
||||
|
||||
<!-- Instead of partition_by, you can provide full engine expression (starting with ENGINE = ) with parameters,
|
||||
Example: <engine>ENGINE = MergeTree PARTITION BY toYYYYMM(event_date) ORDER BY (event_date, event_time) SETTINGS index_granularity = 1024</engine>
|
||||
|
@ -65,6 +65,9 @@ std::shared_ptr<TSystemLog> createSystemLog(
|
||||
engine = "ENGINE = MergeTree";
|
||||
if (!partition_by.empty())
|
||||
engine += " PARTITION BY (" + partition_by + ")";
|
||||
int ttl = config.getInt(config_prefix + ".ttl", 0);
|
||||
if (ttl > 0)
|
||||
engine += " TTL event_date + INTERVAL " + toString(ttl) + " DAY DELETE ";
|
||||
engine += " ORDER BY (event_date, event_time)";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user