28 lines
590 B
SQL
28 lines
590 B
SQL
CREATE DATABASE IF NOT EXISTS netflow;
|
|
|
|
create table if not exists flows (
|
|
id UUID,
|
|
src_addr String,
|
|
dst_addr String,
|
|
src_port UInt16,
|
|
dst_port UInt16,
|
|
protocol UInt16,
|
|
bytes UInt64,
|
|
packets UInt32,
|
|
src_asn UInt32,
|
|
src_as_name String,
|
|
src_lat Float64,
|
|
src_lng Float64,
|
|
src_contry String,
|
|
dst_asn UInt32,
|
|
dst_as_name String,
|
|
dst_lat Float64,
|
|
dst_long Float64,
|
|
dst_contry String,
|
|
flow_time DateTime
|
|
)
|
|
engine = MergeTree
|
|
Partition By toYYYYMM(flow_time)
|
|
Order By (flow_time)
|
|
TTL flow_time + INTERVAL 3 MONTH DELETE;
|