Rust

clickhouse

Module

[ClickHouse]: logs as rows of a ClickHouse MergeTree table, over its HTTP interface.

Contents

use utopia_audit::adapter::clickhouse::ClickHouse;
Rust
pub struct ClickHouse<A = Client<Http>>

The ClickHouse adapter: each log is a row of a MergeTree table (<namespace>_audits in database default unless set otherwise), partitioned by month and ordered by time, with bloom-filter skip indexes. Queries go over ClickHouse's HTTP interface through A, a utopia-client transport (by default a Client over Http with a 30 second timeout, redirects followed and connections reused), with typed {paramN:Type} parameters.

Logs carry the actor (actorId, actorType, actorInternalId; the legacy userId, userType, userInternalId are accepted and returned too), the resource (resource, and its resourceType, resourceId, resourceParent parsed from it when not given), the project, team and host, geo, SDK and user-agent columns. Schema columns missing from a log are taken from its data; the rest of data is stored as JSON.

With shared tables, rows carry the tenant and every read, count and cleanup is limited to the current one.

use utopia_audit::adapter::clickhouse::Options;
Rust
pub struct Options

How to reach ClickHouse, besides its host.

Also implements Default.
Rust
pub const DEFAULT_DATABASE: &str = "default"

The default database, default.

Rust
pub const DEFAULT_PORT: i64 = 8123

The ClickHouse HTTP port, 8123.

Rust
pub const DEFAULT_TABLE: &str = "audits"

The default table name, audits.