# Logfire

> Connect Pydantic Logfire so Ace can query your application logs, traces, exceptions and metrics during investigations.

Source: https://tryace.dev/docs/integrations/logfire

Ace runs bounded, read-only SQL queries against Logfire with a project read token, so it sees your application logs, traces and exceptions without being able to change anything.

| | |
| --- | --- |
| Category | Application logs, traces and exceptions |
| Ace reads | Log and span records, exceptions and metric point counts |
| Ace can change | Nothing (read-only) |
| Opens incidents | No |
| Setup | Settings form |

## What Ace reads

During an investigation, Ace queries the incident window for:

- Record counts by service, environment and level.
- The latest error and exception records.
- Metric point counts.

If you set an **Environment allowlist**, Ace investigates only those environments.

## What Ace can change

Ace changes nothing in Logfire, because a Logfire read token can only read.

## What opens an incident

Logfire doesn't open incidents, and Ace uses it only as evidence.

## Before you start

- The **admin** role in Ace.
- A read token for your Logfire project.

Logfire cloud in the US or EU works as it is. For a self-hosted or dedicated Logfire, you enter a custom HTTPS endpoint, which must be reachable over HTTPS from outside your network because Ace calls it from its cloud.

## Credentials and permissions

| Credential | Where to create it | Permissions | Why Ace needs it |
| --- | --- | --- | --- |
| Read token | Logfire project: **Settings** > **Read tokens** > **Create read token** | Read access to the project | Runs bounded SQL queries over your records |

Logfire shows the token only once, so copy it before you close the dialog.

## Set up

1. Create the read token in your Logfire project.
2. In Ace, go to **Settings** > **Data sources** > **Logfire**.
3. Fill in the form:
   - **Region**: **US (https://logfire-us.pydantic.dev)** or **EU (https://logfire-eu.pydantic.dev)**, to match where your project stores data. For a self-hosted or dedicated deployment, choose **Custom** and enter the **Custom endpoint URL**, which must use HTTPS.
   - **Read token**: starts with `pylf_v1_`.
   - **Environment allowlist** (optional): environment names separated by commas, semicolons or new lines. Leave it blank to investigate every environment the token can see.
4. Choose **Connect Logfire**.

To change the configuration, choose **Update credentials**, then **Save and revalidate**. Ace replaces the stored configuration, validates it again and refreshes discovery.

## Confirm it's working

- Ace checks that the token is valid and can query records, and then the panel shows **Connected** and the discovery panel shows what Ace found.
- If a check fails, fix the cause and choose **Re-validate**.

## Disconnect

In Ace, choose **Disconnect** in **Settings** > **Data sources** > **Logfire**, then revoke Ace's token in your Logfire project under **Settings** > **Read tokens**.

## Next steps

- [LangSmith](https://tryace.dev/docs/integrations/langsmith): add AI workflow traces.
- [How Ace works](https://tryace.dev/docs/concepts/how-ace-works): how evidence feeds an investigation.
- [Security and data](https://tryace.dev/docs/security/security-and-data): what Ace stores.
