Skip to content

Commit cb7e00f

Browse files
jackbridgerTrigger.dev RepoOps
authored andcommitted
docs: document the Logs page and log search
Mono-RevId: 08cabefa9f9afdb95288974f88295bb01cc3e08a
1 parent ca21249 commit cb7e00f

4 files changed

Lines changed: 130 additions & 1 deletion

File tree

‎docs/docs.json‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,12 @@
377377
},
378378
{
379379
"group": "Observability",
380-
"pages": ["observability/query", "observability/dashboards", "reports"]
380+
"pages": [
381+
"observability/logs",
382+
"observability/query",
383+
"observability/dashboards",
384+
"reports"
385+
]
381386
},
382387
{
383388
"group": "Using the Dashboard",

‎docs/logging.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ You can use `console.log()`, `console.error()`, etc as normal and they will be s
1515

1616
We recommend that you use our `logger` object which creates structured logs. Structured logs will make it easier for you to search the logs to quickly find runs.
1717

18+
To search the logs from every run in an environment, use the [Logs page](/observability/logs) in the dashboard.
19+
1820
```ts /trigger/logging.ts
1921
import { task, logger } from "@trigger.dev/sdk";
2022

‎docs/observability/logs.mdx‎

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: "Logs page"
3+
sidebarTitle: "Logs"
4+
description: "What the dashboard Logs page shows, how search matches text, the filters and log levels, and the limits on a search."
5+
---
6+
7+
**The Logs page lists the logs and spans from every run in one environment, newest first, with search across messages and attributes.** Each row links to the run and span it came from. For example, set the level to ERROR, pick a task, and search `orderId:ord_123` to see what went wrong for one order, then open the run at that span.
8+
9+
To write logs and spans from a task, see [Logging, tracing & metrics](/logging). Attributes are the object you pass as the second argument to [`logger`](/logging#logger), for example `{ orderId: "ord_123" }`, and they're searchable.
10+
11+
<Note>
12+
Self-hosted instances need extra setup before the Logs page appears. See [Logs page](/self-hosting/env/webapp#logs-page).
13+
</Note>
14+
15+
## Open the Logs page
16+
17+
The Logs page is under **Observability** in the dashboard sidebar, after you select a project and environment. It shows logs for the selected environment only. Switch environments to search another one.
18+
19+
## Log list
20+
21+
Rows are sorted by the Time column, newest first.
22+
23+
| Column | Description |
24+
| :------ | :---------------------------------------------------------------------------------- |
25+
| Time | When the log was written, or when the span ended, in your dashboard time zone (your browser's by default). |
26+
| Run | The ID of the run the row came from. |
27+
| Task | The task identifier. |
28+
| Level | TRACE, DEBUG, INFO, WARN, or ERROR. See [Log levels](#log-levels). |
29+
| Message | The log message. For an error, the error message. |
30+
31+
Spans are listed once they finish. To watch a span in progress, open its run page. Hover a row and click **View run** to open the run page at the span the row belongs to.
32+
33+
## Log detail panel
34+
35+
Click a row to open it in a side panel. The panel shows:
36+
37+
- The run ID, the run's current status, and **View full run** (shortcut `V`), which opens the run page at the span the row belongs to
38+
- The task, level, and timestamp
39+
- The full message
40+
- The attributes, as JSON
41+
42+
Press `Esc` to close the panel.
43+
44+
## Search syntax
45+
46+
Search runs when you press Enter. It's case-insensitive and searches one block of text: the message, followed by the attributes as JSON, keys included. There are no operators: quotes, `*`, `OR`, and a leading `-` are searched as text or ignored.
47+
48+
| You type | What it matches | Example |
49+
| :------------------------------------------- | :------------------------------------------------------- | :--------------------------------------------------------------------------- |
50+
| One word made only of the letters a to z | That whole word | `timeout` finds "Request timeout", `request_timeout` and a `timeout_ms` key, but not "timeouts". A word cut short, like `declin`, finds nothing |
51+
| Anything else | That exact text, anywhere, including inside longer words | `payment failed` finds "Payment failed" but not "payment has failed". `ord_12` finds `ord_123` |
52+
| `key:value` | An attribute, as text | `orderId:ord_123` finds `logger.info("Order placed", { orderId: "ord_123" })` |
53+
54+
- To match part of a word, include a digit or one of `_ . / : @ + -`, as in `ord_12`. Other punctuation doesn't count, so the `*` in `declin*` has no effect and it's still a whole-word search for `declin`.
55+
- "Anything else" covers several words, numbers, IDs (`run_abc123`), paths (`/api/orders/42`), email addresses, and words with accents or non-Latin characters.
56+
- Punctuation other than `_ . / : @ + -` counts as a space, so `payment, failed` and `payment failed` find the same logs.
57+
- `key:value` is a text match, not a field comparison: `status_code:500` also finds `http_status_code:500`, `status_code:5000`, and the same text in a message. Spaces around the colon are ignored, and the value can contain spaces: `note:payment failed`.
58+
- For a nested attribute, join the keys with colons: `order:id:ord_123` finds `{ order: { id: "ord_123" } }`. Dotted keys, such as OpenTelemetry attributes, are stored nested, so search `http.status_code` as `http:status_code:500`.
59+
60+
## Filters
61+
62+
Filters combine with search.
63+
64+
| Filter | Shortcut | Description |
65+
| :----- | :------- | :---------------------------------------------------------------------------- |
66+
| Task | `T` | Logs from one or more tasks. |
67+
| Run ID | `I` | Logs from one run. Takes a run ID starting with `run_`. |
68+
| Level | `L` | Logs at one or more levels. |
69+
| Time | | A preset period or a custom date range. See [Time range](#time-range). |
70+
71+
There's no run status filter. To list failed runs, use the **Runs** page, then filter the Logs page by run ID.
72+
73+
Click the **X** after the filters to clear all filters and the search.
74+
75+
Filters, the search term, and the selected log are stored in the page URL, so you can copy the URL to share a search.
76+
77+
## Time range
78+
79+
The page shows the last day by default. You can choose a longer period, up to your plan's log retention: 1 day on Free, 7 days on Hobby, and 30 days on Pro. See [log retention limits](/limits#log-retention).
80+
81+
When a search over the default last day finds nothing and your plan keeps logs for longer, the page offers to widen it to 7 days, or to your full retention if that's shorter.
82+
83+
## Log levels
84+
85+
The level filter matches these rows:
86+
87+
| Level | What it includes |
88+
| :---- | :--------------------------------------------------------------------------------------------------------------------------------- |
89+
| TRACE | Spans, from automatic tracing and from [`logger.trace()`](/logging#add-custom-traces). A span that ended with an error is under ERROR instead. |
90+
| DEBUG | `logger.debug()` |
91+
| INFO | `logger.info()` and `logger.log()` |
92+
| WARN | `logger.warn()` |
93+
| ERROR | `logger.error()`, any span or log with an error status, and span events. A span event keeps its own INFO badge. |
94+
95+
Cancelled spans appear only when no level filter is set.
96+
97+
## Search limits
98+
99+
- A search needs at least 3 characters.
100+
- Search covers the first 2 KB of a message and the first 6 KB of its attributes, measured as JSON, keys included. A large attribute, such as a prompt or a tool result, can use up the 6 KB, so keys stored after it aren't searchable. These search limits don't apply to the detail panel, which shows the log as it was stored. To make a value searchable on a large span, log it on its own line with a small attributes object.
101+
- Results load newest first as you scroll. **Searched back to** under the list shows how far the search has reached, and **Showing all** means the whole time range has been searched.
102+
- If a search runs for 20 seconds without filling the page, it pauses and shows **Keep searching**. Click it to continue.
103+
- Large searches run in time slices, and a slice that times out is retried on a smaller one when it can be split. If part of a search still times out, the page keeps what it found and shows **Search incomplete**. A very broad search can also return an error instead. Shorten the time range or add a filter to complete it.
104+
105+
## Related
106+
107+
- [Logging, tracing & metrics](/logging)
108+
- [Query](/observability/query)
109+
- [Dashboards](/observability/dashboards)
110+
- [Log retention limits](/limits#log-retention)

‎docs/self-hosting/env/webapp.mdx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,18 @@ Webhook URLs are served from `WEBHOOK_INGRESS_ORIGIN`, which defaults to `API_OR
258258

259259
The Docker Compose setup only passes the variables listed under the webapp service's `environment` in `hosting/docker/webapp/docker-compose.yml`, so add the webhook variables there. With the Helm chart, set them in `webapp.extraEnvVars`.
260260

261+
## Logs page
262+
263+
The dashboard [Logs page](/observability/logs) needs three things on a self-hosted instance:
264+
265+
1. Store task events in ClickHouse: set `EVENT_REPOSITORY_DEFAULT_STORE=clickhouse_v2` (the default is `postgres`). See [Task events](/self-hosting/docker#task-events). The Logs page only searches events stored in ClickHouse. Switching the default doesn't move existing runs, and runs that already write to PostgreSQL keep writing there.
266+
2. Set `LOGS_SEARCH_DUAL_WRITE_ACTIVE=on` so new logs are also written to the table the Logs page searches. It's `off` by default, which leaves the page empty. It doesn't backfill: logs written before you turn it on aren't searchable. Setting it back to `off` stops new writes but keeps the rows already written. To turn it on for some organizations only, set it to `by-id` and list their IDs, comma-separated, in `LOGS_SEARCH_DUAL_WRITE_ORGANIZATION_IDS`.
267+
3. Give organizations access with the `hasLogsPageAccess` feature flag: turn it on for everyone on the admin dashboard's **Global Feature Flags** page, or for one organization from its feature flags on the **Organizations** page. Without it, only admins see **Logs** in the sidebar.
268+
269+
The Logs page searches at most 30 days back, which isn't configurable. The search table keeps rows for 90 days.
270+
271+
The Docker Compose setup only passes the variables listed under the webapp service's `environment` in `hosting/docker/webapp/docker-compose.yml`, so add `LOGS_SEARCH_DUAL_WRITE_ACTIVE` there, and `LOGS_SEARCH_DUAL_WRITE_ORGANIZATION_IDS` if you use `by-id` (`EVENT_REPOSITORY_DEFAULT_STORE` is already passed). With the Helm chart, set them in `webapp.extraEnvVars`.
272+
261273
## Multi-Provider Object Storage
262274

263275
The object storage system supports multiple S3-compatible providers (R2, S3, GCS, MinIO, etc.) using protocol prefixes. This enables migrating between providers without breaking existing runs.

0 commit comments

Comments
 (0)