| 1 | --- |
| 2 | title: logs |
| 3 | description: Fetch or tail logs from deployed resources, merged and color-coded by resource. |
| 4 | --- |
| 5 | |
| 6 | ```sh |
| 7 | alchemy logs [options] |
| 8 | ``` |
| 9 | |
| 10 | Fetch historical logs from deployed resources, or pass `--tail` to stream |
| 11 | new entries until interrupted. |
| 12 | |
| 13 | Entries from all resources are merged and sorted by timestamp, color-coded by resource. |
| 14 | |
| 15 | `--resource` accepts comma-separated logical IDs. Values are validated against |
| 16 | the stack. An unknown ID fails the command and lists the available IDs. |
| 17 | |
| 18 | Resources must be deployed and their provider must implement log fetching; if none qualify, the command prints `No resources with logs found. Deploy first, then run logs.` and exits. |
| 19 | |
| 20 | ## Flags |
| 21 | |
| 22 | | Option | Description | |
| 23 | | ------------------- | ---------------------------------------------------------------------------------------------- | |
| 24 | | `--stage <name>` | Stage to fetch logs from (defaults to `$ALCHEMY_STAGE` or `live_$USER`) | |
| 25 | | `--resource, -r <ids>` | Comma-separated logical resource IDs to include, such as `Worker,Api` | |
| 26 | | `--limit <n>` | Number of log entries to fetch (default: 100) | |
| 27 | | `--since <time>` | Fetch logs since this time — a duration (`30m`, `1h`, `2d`; units `s`/`m`/`h`/`d`) or ISO date | |
| 28 | | `--tail`, `-t` | Continue streaming new log entries | |
| 29 | | `--profile <name>` | Auth profile to use (defaults to `$ALCHEMY_PROFILE` or `default`) | |
| 30 | | `--env-file <path>` | Load environment variables from a file | |
| 31 | | `--config <path>` | Stack file to read logs for (defaults to `alchemy.run.ts`) | |
| 32 | |
| 33 | ## Examples |
| 34 | |
| 35 | ```sh |
| 36 | # Last 50 log entries from all resources |
| 37 | alchemy logs --limit 50 |
| 38 | |
| 39 | # Logs from the last hour for Worker and Api |
| 40 | alchemy logs --resource Worker,Api --since 1h |
| 41 | |
| 42 | # Tail Worker and Api in real time |
| 43 | alchemy logs --tail --resource Worker,Api |
| 44 | |
| 45 | # Logs from a specific stage since a date |
| 46 | alchemy logs --stage prod --since 2026-04-01T00:00:00Z |
| 47 | ``` |
| 48 | |
| 49 | ## Where next |
| 50 | |
| 51 | - [dev](/cli/dev) — run your stack with hot reloading |
| 52 | - [cloudflare](/cli/cloudflare) — inspect the state-store worker's own logs |