# Logfire

> Query your Logfire logs, spans and metrics with SQL, search recent records, send log lines, and manage projects, read and write tokens, alerts and dashboards.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/logfire

## Actions

### Create alert

Create an alert that runs a SQL query on a schedule and flags it in Logfire when it finds rows.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.
- Name (`name`, text, required): The alert's name.
- SQL query (`query`, text, required): The alert fires when this query finds rows, such as SELECT * FROM records WHERE is_exception.
- Description (`description`, text): What the alert is for.
- Start switched on (`active`, true/false): Turn off to create the alert switched off. Defaults to on. Default: `true`.
- Look at rows from (`time_window`, text): How far back each check looks. Defaults to the last hour. One of: `PT5M` (Last 5 minutes), `PT15M` (Last 15 minutes), `PT30M` (Last 30 minutes), `PT1H` (Last hour (default)), `PT3H` (Last 3 hours), `PT6H` (Last 6 hours), `PT12H` (Last 12 hours), `PT24H` (Last 24 hours). Default: `PT1H`.
- Check (`frequency`, text): How often the alert runs. Defaults to every hour; shorter gaps depend on your Logfire plan. One of: `PT1M` (Every minute), `PT5M` (Every 5 minutes (not on every plan)), `PT15M` (Every 15 minutes), `PT30M` (Every 30 minutes), `PT1H` (Every hour (default)), `PT6H` (Every 6 hours), `PT24H` (Every day). Default: `PT1H`.
- Wait for late data (`watermark`, text): How long to wait for data that arrives late. Defaults to 1 minute. One of: `PT0S` (None), `PT1M` (1 minute (default)), `PT5M` (5 minutes). Default: `PT1M`.
- Notify when (`notify_when`, text): When the alert notifies. Defaults to every check that finds rows. One of: `has_matches` (Every check that finds rows (default)), `has_matches_changed` (Rows are found, and again when they change), `matches_changed` (The rows found change), `starts_having_matches` (Rows are first found). Default: `has_matches`.
- Environments (`environments`, list): Only look at data from these deployment environments, such as production. Leave empty for all of them.

**Outputs**

- `alert` (object): The alert

**Example output**

```json
{
  "alert": {
    "active": true,
    "channels": [],
    "created_at": "2026-10-01T09:00:00Z",
    "created_by_name": "Jo Bloggs",
    "description": "",
    "environments": [],
    "fired": null,
    "frequency": "PT1H",
    "has_errors": null,
    "has_matches": null,
    "id": "5d961928-38f6-41d3-a29e-26ac6f5158e0",
    "last_run": null,
    "name": "Errors in checkout",
    "notify_when": "has_matches",
    "organization_id": "2c1d0e3f-0000-4000-8000-000000000001",
    "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "query": "SELECT trace_id FROM records WHERE is_exception",
    "result_length": null,
    "time_window": "PT1H",
    "updated_at": "2026-10-01T09:00:00Z",
    "watermark": "PT1M"
  }
}
```

### Create read token

Create a read token for a project, optionally with an expiry. The result holds the token itself, which Logfire shows only once.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.
- Expires (`expires_at`, date and time): When the token stops working. Leave empty for a token that never expires.

**Outputs**

- `token` (object): The new token

**Example output**

```json
{
  "token": {
    "created_at": "2026-10-01T09:00:00Z",
    "description": null,
    "expires_at": null,
    "id": "835a8e09-417c-4688-9c5a-9f5dc40cf744",
    "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "token": "pylf_v1_us_example"
  }
}
```

### Create write token

Create a write token for a project, optionally with an expiry. The result holds the token itself, which Logfire shows only once.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.
- Expires (`expires_at`, date and time): When the token stops working. Leave empty for a token that never expires.

**Outputs**

- `token` (object): The new token

**Example output**

```json
{
  "token": {
    "created_at": "2026-10-01T09:00:00Z",
    "description": null,
    "expires_at": null,
    "id": "835a8e09-417c-4688-9c5a-9f5dc40cf744",
    "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "token": "pylf_v1_us_example"
  }
}
```

### Delete alert

Delete an alert and its history. This cannot be undone.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.
- Alert (`alert_id`, text, required): The alert. Pick one, or give its id from an earlier step.

**Outputs**

- `alert_id` (text): The alert deleted
- `deleted` (true/false): Always true once deleted

**Example output**

```json
{
  "alert_id": "5d961928-38f6-41d3-a29e-26ac6f5158e0",
  "deleted": true
}
```

### Get alert

Get one alert with its query, schedule and last check.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.
- Alert (`alert_id`, text, required): The alert. Pick one, or give its id from an earlier step.

**Outputs**

- `alert` (object): The alert

**Example output**

```json
{
  "alert": {
    "active": true,
    "channels": [],
    "created_at": "2026-10-01T09:00:00Z",
    "created_by_name": "Jo Bloggs",
    "description": "",
    "environments": [],
    "fired": null,
    "frequency": "PT1H",
    "has_errors": null,
    "has_matches": null,
    "id": "5d961928-38f6-41d3-a29e-26ac6f5158e0",
    "last_run": null,
    "name": "Errors in checkout",
    "notify_when": "has_matches",
    "organization_id": "2c1d0e3f-0000-4000-8000-000000000001",
    "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "query": "SELECT trace_id FROM records WHERE is_exception",
    "result_length": null,
    "time_window": "PT1H",
    "updated_at": "2026-10-01T09:00:00Z",
    "watermark": "PT1M"
  }
}
```

### Get dashboard

Get one dashboard with its full definition (panels, queries and layout).

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.
- Dashboard (`dashboard_id`, text, required): The dashboard. Pick one, or give its id from an earlier step.

**Outputs**

- `dashboard` (object): The dashboard

**Example output**

```json
{
  "dashboard": {
    "created_at": "2026-09-01T09:00:00Z",
    "created_by_name": "Jo Bloggs",
    "dashboard_name": "Web service",
    "dashboard_slug": "web-service",
    "definition": {},
    "id": "7e1f0c52-3b8a-4a57-8f7d-5a9b1c2d3e4f",
    "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "updated_at": "2026-09-02T09:00:00Z",
    "version": 3
  }
}
```

### Get project

Get one project's name, description, organization and visibility.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.

**Outputs**

- `project` (object): The project

**Example output**

```json
{
  "project": {
    "created_at": "2026-05-24T11:18:22.704455Z",
    "description": null,
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "organization_name": "my-organization",
    "project_name": "my-project",
    "updated_at": "2026-05-24T11:18:22.704455Z",
    "visibility": "private"
  }
}
```

### Get read token project

Check which organization and project the connection's read token belongs to.

**Inputs**: None.

**Outputs**

- `organization_name` (text): The organization
- `project_name` (text): The project

**Example output**

```json
{
  "organization_name": "my-organization",
  "project_name": "my-project"
}
```

### List alerts

List a project's alerts with their query, schedule and how the last check went.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.

**Outputs**

- `alerts` (list): The alerts
- `count` (number): How many were returned

**Example output**

```json
{
  "alerts": [
    {
      "active": true,
      "channels": [],
      "created_at": "2026-10-01T09:00:00Z",
      "created_by_name": "Jo Bloggs",
      "description": "",
      "environments": [],
      "fired": null,
      "frequency": "PT1H",
      "has_errors": null,
      "has_matches": null,
      "id": "5d961928-38f6-41d3-a29e-26ac6f5158e0",
      "last_run": null,
      "name": "Errors in checkout",
      "notify_when": "has_matches",
      "organization_id": "2c1d0e3f-0000-4000-8000-000000000001",
      "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "query": "SELECT trace_id FROM records WHERE is_exception",
      "result_length": null,
      "time_window": "PT1H",
      "updated_at": "2026-10-01T09:00:00Z",
      "watermark": "PT1M"
    }
  ],
  "count": 1
}
```

### List dashboards

List a project's dashboards.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.

**Outputs**

- `count` (number): How many were returned
- `dashboards` (list): The dashboards

**Example output**

```json
{
  "count": 1,
  "dashboards": [
    {
      "created_at": "2026-09-01T09:00:00Z",
      "created_by_name": "Jo Bloggs",
      "dashboard_name": "Web service",
      "dashboard_slug": "web-service",
      "id": "7e1f0c52-3b8a-4a57-8f7d-5a9b1c2d3e4f",
      "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "updated_at": "2026-09-02T09:00:00Z",
      "version": 3
    }
  ]
}
```

### List projects

List the projects the API key can see, with their organization and visibility.

**Inputs**: None.

**Outputs**

- `count` (number): How many were returned
- `projects` (list): The projects

**Example output**

```json
{
  "count": 1,
  "projects": [
    {
      "created_at": "2026-05-24T11:18:22.704455Z",
      "description": null,
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "organization_name": "my-organization",
      "project_name": "my-project",
      "updated_at": "2026-05-24T11:18:22.704455Z",
      "visibility": "private"
    }
  ]
}
```

### List read tokens

List a project's read tokens, with when each expires and whether it is active.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.

**Outputs**

- `count` (number): How many were returned
- `tokens` (list): The read tokens

**Example output**

```json
{
  "count": 1,
  "tokens": [
    {
      "active": true,
      "created_at": "2026-10-01T09:00:00Z",
      "created_by_name": "Jo Bloggs",
      "description": null,
      "expires_at": null,
      "id": "835a8e09-417c-4688-9c5a-9f5dc40cf744",
      "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "project_name": "my-project",
      "token_prefix": "pylf_v1_us"
    }
  ]
}
```

### List variables

List a project's managed variables with their rollouts and labels.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.

**Outputs**

- `count` (number): How many were returned
- `variables` (list): The variables

**Example output**

```json
{
  "count": 1,
  "variables": [
    {
      "created_at": "2026-09-01T09:00:00Z",
      "description": "Greeting shown to new users",
      "id": "9c2d1e0f-4b3a-4c5d-8e7f-6a5b4c3d2e1f",
      "json_schema": {
        "type": "string"
      },
      "kind": "general",
      "labels": {},
      "name": "welcome_message",
      "overrides": [],
      "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "rollout": {
        "labels": {}
      },
      "updated_at": "2026-09-01T09:00:00Z"
    }
  ]
}
```

### List write tokens

List a project's write tokens, with when each expires and whether it is active.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.

**Outputs**

- `count` (number): How many were returned
- `tokens` (list): The write tokens

**Example output**

```json
{
  "count": 1,
  "tokens": [
    {
      "active": true,
      "created_at": "2026-10-01T09:00:00Z",
      "created_by_name": "Jo Bloggs",
      "description": null,
      "expires_at": null,
      "id": "835a8e09-417c-4688-9c5a-9f5dc40cf744",
      "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "project_name": "my-project",
      "token_prefix": "pylf_v1_us"
    }
  ]
}
```

### Revoke read token

Revoke a read token so it stops working at once. This cannot be undone.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.
- Read token (`token_id`, text, required): The read token to revoke. Pick one, or give its id from an earlier step.

**Outputs**

- `revoked` (true/false): Always true once revoked
- `token_id` (text): The token revoked

**Example output**

```json
{
  "revoked": true,
  "token_id": "835a8e09-417c-4688-9c5a-9f5dc40cf744"
}
```

### Revoke write token

Revoke a write token so services using it stop sending data at once. This cannot be undone.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.
- Write token (`token_id`, text, required): The write token to revoke. Pick one, or give its id from an earlier step.

**Outputs**

- `revoked` (true/false): Always true once revoked
- `token_id` (text): The token revoked

**Example output**

```json
{
  "revoked": true,
  "token_id": "835a8e09-417c-4688-9c5a-9f5dc40cf744"
}
```

### Run SQL query

Run a SQL query over the project's logs, spans and metrics and get the rows back. Needs a read token. Looks at the last 24 hours unless you give a time range.

**Inputs**

- SQL query (`sql`, text, required): A SQL query over the project's data, such as SELECT message FROM records WHERE is_exception. Logs and spans are in 'records'; metrics are in 'metrics'.
- From (`min_timestamp`, date and time): Start of the time range to look at. Defaults to 24 hours ago.
- Until (`max_timestamp`, date and time): End of the time range. Leave empty for up to now.
- Row limit (`limit`, number): The most rows to return, 1 to 10,000. Defaults to 100. From 1 to 10000.
- Environments (`environments`, list): Only look at data from these deployment environments, such as production. Leave empty for all of them.
- Time zone (`time_zone`, text): The time zone the query runs in, such as Europe/Paris. Defaults to UTC.

**Outputs**

- `columns` (list): The columns
- `max_timestamp` (text): End of the range, empty for up to now
- `min_timestamp` (text): Start of the range
- `row_count` (number): How many were returned
- `rows` (list): The rows, one object each

**Example output**

```json
{
  "columns": [
    {
      "data_type": "Utf8",
      "name": "message",
      "nullable": false
    }
  ],
  "max_timestamp": "",
  "min_timestamp": "2026-10-19T14:00:00Z",
  "row_count": 1,
  "rows": [
    {
      "message": "Card declined"
    }
  ]
}
```

### Search logs and spans

Find recent logs and spans by message text, service, level, exceptions or trace, newest first. Needs a read token.

**Inputs**

- Message contains (`message_contains`, text): Only records whose message contains this text, in any capitals.
- Service (`service_name`, text): Only records from this service, exactly as Logfire shows it.
- Level (`min_level`, text): Only records at or above this level. Defaults to any level. One of: `any` (Any level (default)), `debug` (Debug and above), `info` (Info and above), `warn` (Warning and above), `error` (Error and above), `fatal` (Fatal only). Default: `any`.
- Only exceptions (`exceptions_only`, true/false): Turn on to see only records that recorded an exception.
- Trace ID (`trace_id`, text): Only records in this trace, as 32 hexadecimal characters.
- From (`min_timestamp`, date and time): Start of the time range to look at. Defaults to 24 hours ago.
- Until (`max_timestamp`, date and time): End of the time range. Leave empty for up to now.
- Row limit (`limit`, number): The most records to return, 1 to 1,000, newest first. Defaults to 100. From 1 to 1000.
- Environments (`environments`, list): Only look at data from these deployment environments, such as production. Leave empty for all of them.

**Outputs**

- `count` (number): How many were returned
- `max_timestamp` (text): End of the range, empty for up to now
- `min_timestamp` (text): Start of the range
- `records` (list): The matching records
- `sql` (text): The query that was run

**Example output**

```json
{
  "count": 1,
  "max_timestamp": "",
  "min_timestamp": "2026-10-19T14:00:00Z",
  "records": [
    {
      "attributes": {
        "order_id": 42
      },
      "exception_message": "insufficient funds",
      "exception_type": "CardDeclined",
      "is_exception": true,
      "level": 17,
      "message": "Card declined",
      "service_name": "checkout",
      "span_id": "b7ad6b7169203331",
      "span_name": "charge card",
      "start_timestamp": "2026-10-20T14:00:00.123456Z",
      "trace_id": "0af7651916cd43dd8448eb211c80319c"
    }
  ],
  "sql": "SELECT start_timestamp FROM records ORDER BY start_timestamp DESC LIMIT 100"
}
```

### Send log

Send one log line to the project, so it shows in Logfire's live view. Needs a write token.

**Inputs**

- Message (`message`, text, required): The text of the log line.
- Service (`service_name`, text, required): The service the log line is shown under in Logfire.
- Level (`level`, text): How serious the log line is. Defaults to info. One of: `debug`, `info` (Info (default)), `warn` (Warning), `error`, `fatal`. Default: `info`.
- Time (`timestamp`, date and time): When it happened. Defaults to now.
- Attributes (`attributes`, object): Extra keys and values to store with the log line.
- Environment (`environment`, text): The deployment environment, such as production.

**Outputs**

- `level` (text): The level sent
- `message` (text): The message sent
- `sent` (true/false): Always true once accepted
- `service_name` (text): The service
- `timestamp` (text): When it happened

**Example output**

```json
{
  "level": "info",
  "message": "Nightly import finished",
  "sent": true,
  "service_name": "lodol-workflows",
  "timestamp": "2026-10-20T14:00:00Z"
}
```

### Update alert

Change an alert's name, query, schedule or on/off state. Fields left empty stay as they are.

**Inputs**

- Project (`project_id`, text, required): The Logfire project. Pick one, or give its id from an earlier step.
- Alert (`alert_id`, text, required): The alert. Pick one, or give its id from an earlier step.
- Name (`name`, text): A new name. Leave empty to keep it.
- SQL query (`query`, text): A new query. Leave empty to keep it.
- Description (`description`, text): A new description. Leave empty to keep it.
- Switched on (`active`, true/false): Turn on or off. Leave unchanged to keep it as it is.
- Look at rows from (`time_window`, text): How far back each check looks. Defaults to the last hour. One of: `PT5M` (Last 5 minutes), `PT15M` (Last 15 minutes), `PT30M` (Last 30 minutes), `PT1H` (Last hour (default)), `PT3H` (Last 3 hours), `PT6H` (Last 6 hours), `PT12H` (Last 12 hours), `PT24H` (Last 24 hours). Default: `PT1H`.
- Check (`frequency`, text): How often the alert runs. Defaults to every hour; shorter gaps depend on your Logfire plan. One of: `PT1M` (Every minute), `PT5M` (Every 5 minutes (not on every plan)), `PT15M` (Every 15 minutes), `PT30M` (Every 30 minutes), `PT1H` (Every hour (default)), `PT6H` (Every 6 hours), `PT24H` (Every day). Default: `PT1H`.
- Wait for late data (`watermark`, text): How long to wait for data that arrives late. Defaults to 1 minute. One of: `PT0S` (None), `PT1M` (1 minute (default)), `PT5M` (5 minutes). Default: `PT1M`.
- Notify when (`notify_when`, text): When the alert notifies. Defaults to every check that finds rows. One of: `has_matches` (Every check that finds rows (default)), `has_matches_changed` (Rows are found, and again when they change), `matches_changed` (The rows found change), `starts_having_matches` (Rows are first found). Default: `has_matches`.
- Environments (`environments`, list): Only look at data from these deployment environments, such as production. Leave empty for all of them.

**Outputs**

- `alert` (object): The alert

**Example output**

```json
{
  "alert": {
    "active": true,
    "channels": [],
    "created_at": "2026-10-01T09:00:00Z",
    "created_by_name": "Jo Bloggs",
    "description": "",
    "environments": [],
    "fired": null,
    "frequency": "PT1H",
    "has_errors": null,
    "has_matches": null,
    "id": "5d961928-38f6-41d3-a29e-26ac6f5158e0",
    "last_run": null,
    "name": "Errors in checkout (updated)",
    "notify_when": "has_matches",
    "organization_id": "2c1d0e3f-0000-4000-8000-000000000001",
    "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "query": "SELECT trace_id FROM records WHERE is_exception",
    "result_length": null,
    "time_window": "PT1H",
    "updated_at": "2026-10-01T09:00:00Z",
    "watermark": "PT1M"
  }
}
```
