Using ClickHouse as a webhook endpoint with HMAC verification
ClickHouse 25.12's new HMAC function lets a ClickHouse HTTP endpoint verify webhook signatures directly in SQL. Requests land in a staging table that captures the raw body via FORMAT RawBLOB and the X-Hub-Signature-256 header via getClientHTTPHeader. A materialized view then forwards only rows whose signature matches HMAC('SHA256', payload, secret) into a JSON-typed table. The walkthrough covers a restricted passwordless insert user, curl tests with valid and rogue keys, and wiring ClickHouse Cloud up as a GitHub webhook receiver. In production it recommends the Null engine for staging, plus rate limits on the webhook user.
Related posts
- Adding Analytics to an Application in under 10 minutes with ClickHouse Cloud Query Endpoints
ClickHouse mediumAdept
ClickHouse Cloud's beta API endpoints turn a saved parameterized SQL query into a secure HTTP POST endpoint, moving SQL out of application code so queries can change without redeploying. The walkthrough adds GitHub stars, issues, forks and PR counts to the ClickPy PyPI dashboard. A query resolves each package's GitHub repo ID from PyPI metadata and aggregates the GitHub events table with uniqExactIf. The endpoint is bound to a read-only role with IP-keyed quotas and optional CORS, then called from a Next.js/React component via a generic fetch helper, returning any of ClickHouse's output formats such as JSONEachRow.
- ClickHouse Newsletter January 2023: Better Safe Than Sorry
ClickHouse mediumAdept
ClickHouse's January 2023 newsletter lists upcoming webinars and recaps the 22.12 release. That release added grace hash join, which joins tables bucket by bucket to cut memory use at some cost in speed. It also brought async insert deduplication, password complexity rules, GROUP BY ALL, underscores in numeric literals, and parallel async reads from MergeTree on object storage. The featured query shows built-in column encryption with encrypt, decrypt and tryDecrypt using AES-128-CBC; tryDecrypt returns NULL for values the user's key cannot decrypt. It is pitched as a cheap security improvement that is weaker than an external KMS.
- 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 Plugin for Grafana - 2.0 Release
ClickHouse mediumAdept
Version 2.0 of the ClickHouse Grafana plugin drops its client-side SQL AST parser and implements ad-hoc filters with ClickHouse's new `additional_table_filters` setting (22.7+), so the server injects each filter into the correct clauses, including subqueries. The release also adds HTTP transport via clickhouse-go's native-format-over-HTTP support, which lets traffic go through load balancers and proxies such as ch-proxy, and splits the connection and query timeouts. It adds JSON Object type support, with leaf nodes usable as columns and logs shown in the Explore view and Logs Panel. Breaking changes: the old automatic 'All' variable optimization is replaced by a manual `$__conditionalAll` macro, ad-hoc filters require ClickHouse 22.7+, and read-only users need readonly=2.
- Using ClickHouse to Monitor Job Queues in GitHub Actions
ClickHouse mediumAdept
GitHub Actions lacks built-in metrics for its workflow job queue, but an organization-level webhook emitting workflow_job events can feed an AWS Lambda that inserts each event into a ClickHouse MergeTree table. The post provides the table schema (LowCardinality columns, an Enum8 status, partitioning by month, ordering by id and updated_at) and example SQL queries. These use argMax over updated_at to recover each job's latest status, chart queued and waiting jobs per hour, compute queue time percentiles by time of day, and show the current queue size per self-hosted runner label.