Sending Kubernetes logs To ClickHouse with Fluent Bit
Fluent Bit deployed as a Kubernetes DaemonSet via its Helm chart can enrich container logs with Kubernetes metadata and ship them to ClickHouse over the HTTP interface using JSONEachRow inserts. A nest filter places all fields under a JSON `log` column, and a Lua filter lifts `host` and `pod_name` to top-level LowCardinality(String) columns so they can serve in the MergeTree primary key alongside timestamp. Recommended practices: use the experimental JSON Object type only for dynamic fields, explicitly type known fields, drop unused fields to avoid column explosion, and tune Fluent Bit's default 1s flush so ClickHouse receives batches of at least ~1000 rows. A sample Grafana dashboard (ID 17284) visualizes the resulting data.
Related posts
- Building an Observability Solution with ClickHouse - Part 1 - Logs
ClickHouse mediumAdept
ClickHouse can serve as the storage backend for Kubernetes log collection using any of three agents: the OpenTelemetry Collector, Vector and Fluent Bit. Each agent can be deployed via Helm in agent (DaemonSet) and aggregator roles. Aggregators batch data into larger inserts that match ClickHouse insert best practices, and small deployments that skip them should use asynchronous inserts to avoid too many parts. The OTEL exporter (alpha) hard-codes its schema, while Vector (beta, HTTP/JSON sink) lets users define their own tables. Map types are recommended for sparse Kubernetes labels and annotations, and the post closes with compression results and example SQL queries for analyzing logs by pod, time window and string or regex match.
- Sending Nginx logs to ClickHouse with Fluent Bit
ClickHouse mediumAdept
Fluent Bit can ship Nginx access logs into ClickHouse by tailing the log file with the nginx_access parser, nesting all parsed fields under a single `log` key with the Nest filter, and posting them through the HTTP output plugin as JSONEachRow inserts. The ClickHouse side uses a MergeTree table with the experimental JSON object type (`allow_experimental_object_type`), so fields are discovered without a predefined schema. Once loaded, fields can be inspected with `describe_extend_object_types` and queried by dot path, for example grouping by `log.code` to count status codes. Grafana's ClickHouse plugin can then visualize the logs.
- Sending Windows Event Logs to ClickHouse with Fluent Bit
ClickHouse mediumAdept
Fluent Bit's winevtlog input can collect Windows Event Logs, including the Sysmon/Operational and Security channels, and ship them to ClickHouse over HTTP as JSONEachRow with async_insert enabled. Sysmon uses SwiftOnSecurity's MITRE ATT&CK-aligned configuration, and logs land in a MergeTree table built on the experimental JSON object type, whose inferred schema is shown. Grafana's ClickHouse plugin provides threat-hunting dashboards, and SysmonSimulator generates test events. For production, map frequent fields such as Computer to explicit LowCardinality columns and put them in the ORDER BY key instead of relying on dynamic JSON with tuple().
- ClickHouse and OpenTelemetry
ClickHouse mediumAdept
ClickHouse now officially supports the OpenTelemetry Collector exporter for ClickHouse, which has reached beta for logs and traces. The exporter ships a "one size fits most" default schema. For production, ClickHouse recommends disabling automatic table creation, because concurrent exporters race to create tables, and defining your own tables or materialized views keyed to your query patterns. The LogHouse schema behind ClickHouse's 43 PB internal logging platform serves as the worked example. It orders by (PodName, Timestamp), uses LowCardinality for string columns under about 10k distinct values, applies ZSTD(1) because data lives on S3, and puts Bloom-filter indexes on map keys and values, which are not yet tuned.
- 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.