Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/content/docs/logs/logpush/transformers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ products:
- logpush
---

import { DashButton, Badge } from "~/components";
import { APIRequest, DashButton, Badge } from "~/components";

<Badge text="Beta" variant="caution" />

:::note[Closed beta]
Transformers are in closed beta. Contact your Cloudflare Account Executive for access. Beta usage is not billed. The API surface may change before GA.
:::note[Beta]
Transformers are in beta. Contact your Cloudflare Account Executive for access. Beta usage is not billed.
:::

Transformers let you run a SQL query against each batch of records before Logpush delivers them to your destination. Use them to filter records you do not want to store, reshape fields to match a downstream schema, redact sensitive values, compute new fields, or add static metadata.
Expand Down Expand Up @@ -70,6 +70,18 @@ Every transformer action is available through the Cloudflare API. To authenticat
| Update a transformer | `PUT` | `accounts/:account_id/logpush/transformers/:id` |
| Delete a transformer | `DELETE` | `accounts/:account_id/logpush/transformers/:id` |

The following request creates a transformer that selects three fields from the zone-scoped `dns_logs` dataset:

<APIRequest
path="/accounts/{account_id}/logpush/transformers"
method="POST"
json={{
name: "dns-query-fields",
description: "Selects key fields from DNS query logs.",
code: "SELECT QueryName, QueryType, ResponseCode FROM dns_logs",
}}
/>

To attach or detach a transformer from a job, set `transformer_id` on the Logpush job. Refer to [Logpush job setup](/logs/logpush/logpush-job/) for job endpoints.

## The SQL transformer contract
Expand Down Expand Up @@ -118,7 +130,7 @@ In the dashboard, validation errors appear inline in the editor with line and co

| Limit | Value |
| ------------------------------ | ----------- |
| SQL query size | 10 KB |
| SQL query size | 250 KB |
| Transformer name length | 255 bytes |
| Transformer description length | 4,096 bytes |
| Filesystem access from a query | None |
Expand Down Expand Up @@ -270,11 +282,11 @@ Delivered record:

| HTTP | Message | Cause |
| ----- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `403` | `transformer feature is not available for this account` | Your account does not have access to Transformers. Contact your Cloudflare Account Executive. |
| `403` | `transformer feature is not available for this account` | Your account does not have access to Transformers. |
| `400` | `missing required field: name` | Add a `name` field to the request body. |
| `400` | `missing required field: code` | Add a non-empty `code` field with your SQL query. |
| `400` | Schema validation error (unknown column, invalid syntax) | The SQL references a field that does not exist, uses unsupported syntax, or has a type mismatch. Fix the query and retry. |
| `413` | (request entity too large) | The SQL query exceeds 10 KB. Shorten the query. |
| `413` | (request entity too large) | The SQL query exceeds 250 KB. Shorten the query. |
| `400` | `transformer N not found for this account` | The transformer ID does not exist, or belongs to a different account. |
| `400` | `transformer N dataset "X" does not match job dataset "Y"` | The transformer's `FROM` table does not match the job's dataset. |

Expand Down
Loading