> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Logs

> Read runtime output and platform-generated invocation logs for Edge Compute functions.

Edge Compute exposes two log types through the same CLI command and API endpoint:

| Type          | Source                | What it contains                                                                |
| ------------- | --------------------- | ------------------------------------------------------------------------------- |
| `runtime`     | Your function         | stdout/stderr such as `console.log`, `console.error`, and uncaught exceptions   |
| `invocations` | Edge Compute platform | One record for each HTTP request served, even when your function writes no logs |

## Runtime logs

Runtime logs are the default:

```bash theme={null}
telnyx-edge logs my-func
telnyx-edge logs my-func --type runtime
telnyx-edge logs my-func --since 10m
telnyx-edge logs my-func --last 200
telnyx-edge logs my-func --json
```

Each line prints as `[timestamp] [level] message`, oldest first. The level is best-effort and can be inaccurate on stack traces; a multi-line error arrives as several separate entries.

## Invocation logs

Use `--type invocations` for platform-generated request records:

```bash theme={null}
telnyx-edge logs my-func --type invocations
telnyx-edge logs my-func --type invocations --since 10m
telnyx-edge logs my-func --type invocations --last 200
telnyx-edge logs my-func --type invocations --json
```

Invocation logs report traffic even when your code never calls `console.log`. Each record includes request metadata such as timestamp, HTTP method, path, status code, duration, request and response size, and serving region when available.

`--since`, `--last`, and `--json` work the same way for both log types. `--since` defaults to `1h` and is capped at `24h`; `--last` defaults to `50` and is capped at `250`. Results are returned oldest first.

The API exposes both streams through `GET /v2/compute/funcs/{id}/logs` with `type=runtime` or `type=invocations`. See the [API Reference](/docs/edge-compute/observability/api-reference).

## Emit custom events to a sink you run

Runtime and invocation logs cover platform-retained logs. If you also need application-specific structured events in your own system, send them over HTTPS to a collector you control. Store the collector credential as a [secret](/docs/edge-compute/configuration/secrets), never in code.

Declare the secret in `func.toml`:

```toml theme={null}
[[secrets]]
binding = "LOG_SINK_KEY"
name    = "LOG_SINK_KEY"
```

```bash theme={null}
telnyx-edge secrets add LOG_SINK_KEY "<your collector's API key>"
telnyx-edge types
```

Keep telemetry off the response's critical path, apply an outbound timeout, and do not let a failed telemetry request fail the function response. Log metadata rather than sensitive request payloads.

See the [CLI reference](/docs/edge-compute/reference/cli#logs) for the full command reference.
