1-- +goose Up
2CREATE TABLE IF NOT EXISTS alky_dns_queries (
3 timestamp DateTime,
4 instance_id String,
5 query_name String,
6 query_type String,
7 query_class String,
8 remote_addr String,
9 response_code String,
10 duration Int64,
11 cache_hit Bool
12) ENGINE = MergeTree()
13PARTITION BY toYYYYMM(timestamp)
14ORDER BY (timestamp, instance_id, query_name)
15TTL timestamp + toIntervalDay(30);
16
17CREATE TABLE IF NOT EXISTS alky_dns_cache_metrics (
18 timestamp DateTime,
19 instance_id String,
20 total_queries Int64,
21 cache_hits Int64,
22 cache_misses Int64,
23 negative_hits Int64,
24 positive_hits Int64,
25 evictions Int64,
26 size Int,
27) ENGINE = MergeTree()
28PARTITION BY toYYYYMM(timestamp)
29ORDER BY (timestamp, instance_id)
30TTL timestamp + toIntervalDay(30);
31
32-- +goose Down
33DROP TABLE IF EXISTS alky_dns_queries;
34DROP TABLE IF EXISTS alky_dns_cache_metrics;