Skip to content

DuckDB Extension

Events

Send DuckDB query and transaction events to an external handler as JSON. Configure event types and session labels for logging or monitoring.

18,000
extension loads Β· last 90 days
On this page

Send DuckDB activity to an event handler

Events exposes query, transaction, and connection activity from a DuckDB process. It starts a handler program and writes structured JSON events to that program’s standard input.

Use the stream to build a query log, track failures, or feed an existing monitoring system. You choose which events to capture and what the handler does with them. The extension provides the events; storing them and sending alerts are responsibilities of the handler.

Example

Send query events to a handler

Configure an executable that reads JSON from standard input, then run a query that produces events.

Before you run it: Create an executable handler and replace the placeholder path. The handler example explains the input contract.

Run this example in the DuckDB CLI or a native client.

INSTALL events FROM community;
LOAD events;

-- Replace this path with your executable event handler.
SET events_destination = '/absolute/path/to/event-handler';
SET events_types = ['query_begin', 'query_end'];
SET events_session_name = 'example-session';
SELECT 42 AS answer;

The SQL returns 42; the event payloads go to the handler, not the result table. Configure only the event types your handler needs.

Common tasks

Deep Dive

Technical Details

Reference

Extension Contents

Quick reference to all available functions and settings organized by category.

Configuration
events_async Object type: Setting When TRUE, events are delivered fire-and-forget β€” DuckDB doesn't wait for the handler before returning from the originating query.
events_destination Object type: Setting Path to an external program that receives event JSON via stdin.
events_session_name Object type: Setting Optional string included in every event.
events_types Object type: Setting List of event types to capture.

Configuration

Settings

Configure the events extension behavior using these settings.

events_async

Default Value: false

events_destination

Default Value: β€”

events_session_name

Default Value: β€”

events_types

Default Value: [query_begin, query_end]

Practical Examples

Cookbook

Real-world recipes and patterns for common use cases.

Platform Support

Compatibility

Extension availability may vary by platform and DuckDB version. Check below to ensure this extension supports your environment before installation.

Quick Facts

Release status Stable
Software License MIT
Pricing Free
Written In C++
Source Available Yes
View on GitHub
Usage
18,000
loads Β· last 90 days

Platforms

Haybarn 1.5.6

  • Linux x86_64aarch64
  • Linux (musl) Not available
  • macOS IntelApple Silicon
  • Windows x86_64x86_64 (MinGW)
  • WASM Not available
Compiled binary sizes
Platform Architecture Size
Linux x86_64 3.22 MB
Linux aarch64 2.85 MB
macOS Intel 2.60 MB
macOS Apple Silicon 2.26 MB
Windows x86_64 7.39 MB
Windows x86_64 (MinGW) 12.85 MB

Compressed download sizes for the release shown above.

DuckDB & Haybarn

Release calendar
  • Haybarn v1.5.6 Built-in community repository Supported

Browser examples use Haybarn-Wasm 2.0.0-rc12.

Checked .