1
0
forked from baron/baron-sso

병합 이후 검토 적용

This commit is contained in:
2026-06-15 20:28:10 +09:00
parent 202c783920
commit 35284d72ed
35 changed files with 996 additions and 62 deletions

View File

@@ -0,0 +1,16 @@
CREATE TABLE baron_sso.audit_logs
(
`event_id` String,
`timestamp` DateTime DEFAULT now(),
`user_id` String,
`tenant_id` String,
`event_type` String,
`status` String,
`ip_address` String,
`user_agent` String,
`device_id` String,
`details` String
)
ENGINE = MergeTree
ORDER BY timestamp
SETTINGS index_granularity = 8192

View File

@@ -0,0 +1,14 @@
CREATE TABLE baron_sso.rp_usage_daily_aggregate
(
`event_date` Date,
`tenant_id` String,
`tenant_type` String,
`client_id` String,
`client_name` String,
`event_type` String,
`events_count` AggregateFunction(count),
`unique_subjects` AggregateFunction(uniqExact, String)
)
ENGINE = AggregatingMergeTree
ORDER BY (event_date, tenant_id, client_id, event_type)
SETTINGS index_granularity = 8192

View File

@@ -0,0 +1,28 @@
CREATE MATERIALIZED VIEW baron_sso.rp_usage_daily_aggregate_mv TO baron_sso.rp_usage_daily_aggregate
(
`event_date` Date,
`tenant_id` String,
`tenant_type` String,
`client_id` String,
`client_name` String,
`event_type` String,
`events_count` AggregateFunction(count),
`unique_subjects` AggregateFunction(uniqExact, String)
)
AS SELECT
toDate(occurred_at) AS event_date,
tenant_id,
tenant_type,
client_id,
any(client_name) AS client_name,
event_type,
countState() AS events_count,
uniqExactState(subject) AS unique_subjects
FROM baron_sso.rp_usage_events
WHERE tenant_type IN ('COMPANY', 'ORGANIZATION')
GROUP BY
event_date,
tenant_id,
tenant_type,
client_id,
event_type

View File

@@ -0,0 +1,19 @@
CREATE TABLE baron_sso.rp_usage_events
(
`event_id` String,
`occurred_at` DateTime64(3) DEFAULT now64(3),
`event_type` String,
`subject` String,
`tenant_id` String,
`tenant_type` String,
`client_id` String,
`client_name` String,
`session_id` String,
`scopes` Array(String),
`source` String,
`correlation_id` String,
`payload` String
)
ENGINE = MergeTree
ORDER BY (occurred_at, event_id)
SETTINGS index_granularity = 8192