Back
Logflare Wrapper

Logflare Wrapper

Overview

Logflare Wrapper

Logflare is a log ingestion and querying engine that stores and queries log events in a columnar database. It provides centralized log management for Cloudflare, Vercel, Elixir, and other sources, with support for OpenTelemetry ingestion and BigQuery as a storage backend.

The Logflare Wrapper brings your Logflare endpoint data into Postgres as queryable foreign tables. Query any Logflare endpoint with plain SQL, pass parameters directly from your query, and join log data against your application data. It is read-only and works with Supabase Vault for secure API key management.

Preparation

Before you get started, make sure the wrappers extension is installed on your database:


_10
create extension if not exists wrappers with schema extensions;

and then create the foreign data wrapper:


_10
create foreign data wrapper logflare_wrapper
_10
handler logflare_fdw_handler
_10
validator logflare_fdw_validator;

Secure your credentials (optional)

By default, Postgres stores FDW credentials inside pg_catalog.pg_foreign_server in plain text. Anyone with access to this table will be able to view these credentials. Wrappers is designed to work with Vault, which provides an additional level of security for storing credentials. We recommend using Vault to store your credentials.


_10
select vault.create_secret(
_10
'<Logflare API key>',
_10
'logflare',
_10
'Logflare API key for Wrappers'
_10
);

Connecting to Logflare

We need to provide Postgres with the credentials to connect to Logflare, and any additional options. We can do this using the create server command:

With Vault:


_10
create server logflare_server
_10
foreign data wrapper logflare_wrapper
_10
options (
_10
api_key_id '<key_ID>' -- The Key ID from above.
_10
);

Without Vault:


_10
create server logflare_server
_10
foreign data wrapper logflare_wrapper
_10
options (
_10
api_key '<Logflare API key>'
_10
);

Foreign table options

Each foreign table requires one option:

  • endpoint - Logflare endpoint UUID or name, required.

Foreign tables also support a special _result meta column (type text) that stores the full result record as a JSON string, and parameter columns prefixed with _param_ that are passed through to the endpoint. For example, _param_org_id and _param_iso_timestamp_start map to the corresponding endpoint parameters.

Resources

Details

DeveloperSupabase
DocumentationLearn

Third-party integrations and docs are managed by Supabase partners.

Get started with Logflare Wrapper and Supabase.