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

# Logs, analytics and monitoring

> See what your app prints, how visitors use it, and how much CPU and memory it needs, from the project page or the CLI.

Three tabs tell you how a project is doing:

| Tab | Answers | Plan |
| - | - | - |
| **Live Logs** | What is my app printing right now? Did it start cleanly? | All |
| **Web Analytics** | Who visits, which pages, from where, and how many requests are blocked? | Plus and above |
| **Monitoring** | How much CPU and memory does each instance use? | Plus and above |

When an app is slow or failing, look at all three: logs for errors, analytics for a traffic spike, monitoring for a memory ceiling.

## Live Logs

![The Live Logs tab showing recent runtime output from a project.](https://mintcdn.com/pxxl/BmMwkLenE04VSQYP/images/project-live-logs.jpeg?fit=max\&auto=format\&n=BmMwkLenE04VSQYP\&q=85\&s=66839303b6be50a48913aeb11a7163c3)

**Live Logs** shows the latest output of your running app (everything it writes to stdout and stderr) and refreshes every few seconds. Static sites show recent edge request logs instead.

* **Download Logs** saves what's on screen to a file.
* Build output isn't here. Open the deployment in [Deployments](https://docs.pxxl.app/projects/deployments.md) and choose **View logs**.

Log useful context in one line, so it's easy to find:

```js theme={null}
console.log(JSON.stringify({ level: "info", msg: "order created", orderId, ms: Date.now() - start }));
```

### Logs from the CLI

```bash theme={null}
pxxl logs --project <project-id>                  # recent output
pxxl logs --project <project-id> --follow         # keep streaming
pxxl logs --project <project-id> --since 1h --lines 500
pxxl logs --deployment <deployment-id>            # one deployment's log
```

| Flag | What it does |
| - | - |
| `--project <id>` | The project to read. |
| `--deployment <id>` | Read one deployment's log instead. |
| `--since <duration>` | Only logs newer than this, such as `15m`, `1h`, `24h`. |
| `--lines <n>` | How many lines to print. |
| `--follow` | Keep printing new lines until you press Ctrl-C. |

### Keep logs longer

Live Logs is for what's happening now. To keep logs for weeks, search them, or alert on them, send them to your own storage or log tool with a [log drain](https://docs.pxxl.app/projects/log-drains.md).

## Web Analytics

**Web Analytics** counts every request that reaches the project through the Pxxl edge. There's no script to add.

| Section | What it shows |
| - | - |
| Headline numbers | Visits, Requests, Blocked, Page views, Top country, Top city, Busiest day, Peak time. |
| **Locations** | Visitors by country and city. |
| **Busiest times** | Traffic by day of the week and hour (UTC), and an activity heatmap. |
| **Top paths** | The most requested paths. |
| **Requests** | A table of recent requests. |
| Domains | The same numbers per domain of the project. |

**Blocked** counts requests the edge refused before they reached your app: [rate limits](https://docs.pxxl.app/networking/edge-settings.md#rate-limiting), blocked IPs or countries, blocked methods, and oversized requests.

## Monitoring

![The Monitoring tab with CPU and memory charts for a project's instances.](https://mintcdn.com/pxxl/BmMwkLenE04VSQYP/images/project-monitoring.jpeg?fit=max\&auto=format\&n=BmMwkLenE04VSQYP\&q=85\&s=018032d165a31f3b4e6f597bb2e0b308)

**Monitoring** charts CPU and memory for each instance.

* **CPU** as a percentage of what the instance is given.
* **Memory** used out of the instance's limit, with its peak.
* Pick a period: **24h**, **48h**, **72h**, **7d** or **30d**.
* Pick one instance, or all of them, when the project has replicas. **Refresh** reloads the data.

Reading the charts:

* Memory climbing steadily until a restart usually means a leak, or a cache without a limit.
* Memory flat at the limit, then a restart, means the app ran out of memory. Give it more in [Compute and scaling](https://docs.pxxl.app/projects/scaling.md) or use less.
* CPU pinned at 100% during traffic spikes means it's time for more CPU or more replicas.

## Where to go next

> [card] [Log drains](https://docs.pxxl.app/projects/log-drains.md)
>
> Send logs to your own bucket or endpoint.

> [card] [Compute and scaling](https://docs.pxxl.app/projects/scaling.md)
>
> Add CPU, memory or replicas.


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