Sending Nginx logs to ClickHouse with Fluent Bit
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.
Related posts
- Sending Kubernetes logs To ClickHouse with Fluent Bit
ClickHouse mediumAdept
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.
- 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().
- Structured Logging in .NET with Serilog and ClickHouse
ClickHouse mediumAdept
Serilog's ClickHouse sink lets an ASP.NET service write structured logs directly into a ClickHouse table with one WriteTo.ClickHouse() call. A fluent C# schema builder controls the table: typed JSON property hints, promoted columns such as CorrelationId, a text inverted index on messages, a MergeTree ORDER BY key and a TTL. The demo also covers correlation ID middleware via LogContext, single per-request summary events with UseSerilogRequestLogging and IDiagnosticContext, and flushing batched events with Log.CloseAndFlushAsync on shutdown. For production, manage the schema externally rather than letting the sink create it, and tune compression codecs and Kubernetes-aware sort keys.
- 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.