Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 12 min read How-to mediumAdept

Analyzing AWS Flow Logs using ClickHouse

VPC Flow Logs exported to S3 as Parquet can be loaded into ClickHouse and queried with SQL to find rejected traffic, top talkers, internet ingress/egress and costly cross-AZ transfers. The walkthrough infers a schema with clickhouse local, then tunes it with LowCardinality strings, IPv4 and DateTime types, an Enum for action, and a sort key on action, srcaddr, dstaddr, protocol and time. About 517M rows compress to 2.3 GiB. Import runs via the s3() table function in roughly 12 minutes, and aggregation queries finish in 0.6 to 30 seconds. Enriching flows with EC2 metadata from the AWS API supplies the availability zone mapping needed to attribute cross-AZ traffic.

Related posts

  • How Cloud CIRCUS used ClickHouse to speed up and simplify log analytics

    ClickHouse mediumAdept

    Cloud CIRCUS replaced Amazon Athena with a self-managed ClickHouse instance on a single 4 vCPU / 32 GB EC2 machine to analyze CloudFront access logs from 2,000+ BlueMonkey customer sites. All distributions now share a single MergeTree table partitioned by day and sorted by host_header and date. Logs load from S3 via the s3 table function, run by EventBridge-scheduled ECS jobs that fan out across 20 Fargate tasks, which cut ingestion from hours to under 30 minutes while keeping memory below 80%. A per-site query dropped from about 16 s to 0.043 s, and a cross-site aggregation over 470M rows finishes in under 9 s, at a flat cost of about $300/month versus Athena's unpredictable per-scan billing.

  • How Buildkite transformed test analytics and cut costs with ClickHouse Cloud

    ClickHouse easyNovice

    Buildkite Test Engine replaced a Kafka/Flink pipeline that pre-aggregated test metrics into Postgres, DynamoDB and Iceberg with on-demand queries against ClickHouse Cloud, letting customers group and filter billions of test executions by arbitrary JSON tags in real time. ClickHouse's JSON type, which creates a column per tag key, and its high ingest rate (25K events/sec sustained, 12B events/month, 70B rows) were the deciding factors over Druid and Pinot. While ingestion quadrupled, net infrastructure spend fell by five figures per month. The savings came from scaling Flink down more than 60%, retiring DynamoDB and halving Aurora capacity, which works out to roughly $8 saved for every $1 spent on ClickHouse.

  • How we Built a 19 PiB Logging Platform with ClickHouse and Saved Millions

    ClickHouse mediumAdept

    ClickHouse replaced Datadog for internal logging with LogHouse, a per-region ClickHouse deployment holding over 19 PiB uncompressed (37 trillion rows) for its AWS regions. The data compresses about 17x on S3-backed SharedMergeTree storage with local NVMe caches, and the team claims the system is at least 200x cheaper than Datadog list pricing. A team of 1.5 engineers built it in under three months. Key design choices were OpenTelemetry collectors writing directly to ClickHouse with no Kafka buffer, no cross-region data transfer (queries span regions instead), and a move from plaintext to structured JSON logs. Frequently queried fields such as pod_name are extracted into ordering-key columns, while the rest is stored in a Map(String, String). Tradeoffs include higher in-transit drop rates, caused by uneven agent-to-gateway connections and the lack of autoscaling in the ingest layer.

  • Clever ingests 200x more logs at the same cost with ClickHouse Cloud

    ClickHouse mediumAdept

    Clever replaced a split Datadog/Athena logging setup with ClickHouse Cloud. It now indexes all ~150 TB/month of logs from 400 services and 200 Lambdas with 60-day retention, a 200x increase in searchable volume, at no extra cost and with 10x compression. The schema extracts hot fields into columns and stores the rest as raw JSON plus an attributes map. It uses token bloom filter indexes at granularity 32 for full-text search, date partitions with a 60-day TTL, and orders by negative Unix timestamp for an 8-10x query speedup. Resilience comes from separate dev and per-region prod services joined via remoteSecure and merge tables, all managed with Terraform and Goose. A custom LogQL-to-SQL layer keeps Grafana familiar for engineers.

  • How Jump Trading uses ClickHouse with Iceberg for analytics

    ClickHouse mediumAdept

    Jump Trading runs a self-managed, on-prem ClickHouse cluster of tens of nodes as the system of record for petabyte-scale trading logs, ingesting hundreds of TB per day with peaks of 10M rows/sec and a sub-20-second p99, reconciled daily for zero data loss. Raw logs flow through Redpanda to sharded bare-metal ingestors, distributed tables shard the fact tables, and replicated tables hold reference data. To serve heavy batch and HPC readers without loading the real-time cluster, Jump added a Netflix-style double-write pipeline: Kafka feeds parallel consumers writing to ClickHouse and to Iceberg Parquet on object storage. ClickHouse queries both, keeping the same access control and observability, and a 20-node Iceberg setup scanned 376 billion rows in 9.6 seconds.

The quest for software engineering knowledge.

Look:
Layout: