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

# Runtime Logs & Analytics

> View request logs, server function output, and performance metrics for your Canvas app.

## Overview

Canvas captures two types of runtime data for every app:

* **Request logs** — every HTTP request hitting your app (method, path, status, duration)
* **Runtime logs** — `console.log/warn/error/info` output from [server functions](https://docs.mixpeek.com/docs/canvas/apps/server-functions.md)

Both are kept for 30 days and are queryable via API or Studio.

***

## Request logs

Every request to your Canvas app is logged automatically — no configuration needed.

### Query via API

```bash theme={null}
curl "https://api.mixpeek.com/v1/apps/$APP_ID/logs?log_type=requests&hours=1&limit=100" \
  -H "Authorization: Bearer $API_KEY"
```

Response:

```json theme={null}
{
  "app_id": "app_1433d93d7a95",
  "log_type": "requests",
  "entries": [
    {
      "timestamp": "2026-03-29 21:21:02.750",
      "method": "GET",
      "path": "/",
      "status_code": 200,
      "duration_ms": 74,
      "user_agent": "Mozilla/5.0 ...",
      "ip": "68.175.65.201"
    }
  ]
}
```

### Parameters

| Parameter | Type | Default | Description |
| - | - | - | - |
| `log_type` | `string` | `runtime` | `runtime` or `requests` |
| `hours` | `integer` | `1` | Lookback window (1–168 hours) |
| `level` | `string` | — | Filter by log level (runtime only): `log`, `warn`, `error`, `info` |
| `limit` | `integer` | `100` | Max entries returned (1–1000) |

***

## Runtime logs

Server function `console` output is automatically captured and stored. Each log entry includes the function route and log level.

### Query via API

```bash theme={null}
# All runtime logs from the last hour
curl "https://api.mixpeek.com/v1/apps/$APP_ID/logs?log_type=runtime&hours=1" \
  -H "Authorization: Bearer $API_KEY"

# Only errors
curl "https://api.mixpeek.com/v1/apps/$APP_ID/logs?log_type=runtime&hours=24&level=error" \
  -H "Authorization: Bearer $API_KEY"
```

Response:

```json theme={null}
{
  "app_id": "app_1433d93d7a95",
  "log_type": "runtime",
  "entries": [
    {
      "timestamp": "2026-03-29 22:15:03.456",
      "level": "error",
      "message": "Failed: connection timeout",
      "route_path": "search",
      "request_id": "req_abc123"
    }
  ]
}
```

***

## Studio

In Studio, the App details page has an **Analytics** panel with three tabs:

| Tab | What it shows |
| - | - |
| **Overview** | Error rates, web vitals, custom events |
| **Runtime Logs** | Server function console output with level badges |
| **Requests** | HTTP request log with method, path, status, and duration |

Both log tabs auto-refresh every 10 seconds and support filtering by time range and log level.

***

## What's captured

### Request log fields

| Field | Description |
| - | - |
| `timestamp` | When the request was received |
| `method` | HTTP method (GET, POST, etc.) |
| `path` | Request path |
| `status_code` | HTTP response status |
| `duration_ms` | Time to process the request (ms) |
| `user_agent` | Client user agent string |
| `ip` | Client IP address |

### Runtime log fields

| Field | Description |
| - | - |
| `timestamp` | When the log was emitted |
| `level` | `log`, `warn`, `error`, or `info` |
| `message` | The logged message (truncated to 2000 chars) |
| `route_path` | Which server function produced the log |
| `request_id` | Correlates logs to a specific request |

***

## Retention

All log data is retained for **30 days** and automatically purged after that.

***

## Related

* [Server Functions](https://docs.mixpeek.com/docs/canvas/apps/server-functions.md)
* [Build Logs](https://docs.mixpeek.com/docs/canvas/apps/build-logs.md)
* [Deploy from Code](https://docs.mixpeek.com/docs/canvas/apps/deploy.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.