> For the complete documentation index, see [llms.txt](https://django-cloud.gitbook.io/django-cloud-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://django-cloud.gitbook.io/django-cloud-docs/how-it-works/logs-and-metrics.md).

# Logs and metrics

See what your app is doing without opening the AWS console.

## Logs

The **Logs** tab of a deployment shows three kinds of lines:

| Source      | What it is                                                                                                                                          |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| **App**     | Everything your app writes to standard output and standard error. Use a console log handler.                                                        |
| **Build**   | The output of building your image, including the `[djangocloud]` notes about [your settings](/django-cloud-docs/how-it-works/how-your-app-runs.md). |
| **Release** | What DjangoCloud did to roll your release out: deploying, health checks, and why a release failed.                                                  |

### Searching

* **Search** shows lines that contain your text. Separate several terms with commas or new lines, up to 10.
* **Exclude** hides lines that contain any of its terms, which is handy for silencing a noisy health check.
* **Time range:** the last 15 minutes, 1 hour, 6 hours, 24 hours, 7 days, or all, or a **custom range** (in UTC).
* **Level:** all levels, warnings and errors, or errors only. The level is read from the line's own text.
* **Source:** app, build or release.
* **Live** keeps the view up to date every few seconds. Switch it off to read without it moving.

The page shows the newest 300 matching lines and tells you when there are more, so narrow the range or add a search term to get to older ones. Lines keep the time your app logged them.

### From the terminal

```bash
djangocloud logs                       # the latest 100 lines
djangocloud logs -f                    # keep streaming (Ctrl-C to stop)
djangocloud logs -n 500 --source app   # only your app's output
djangocloud logs --since 2h            # 90s, 30m, 2h or 7d
```

### How long logs are kept

Your app's log is collected every couple of minutes, so the newest lines can be a little behind. Lines are kept for **3 days** on your own AWS account (Starter), **7 days** on Company and **30 days** on Enterprise, and at most 20,000 lines per deployment, so one very noisy app can't fill the database. See [Known limitations](/django-cloud-docs/reference/limitations.md).

## Metrics

The **Metrics** tab shows two charts: **CPU** and **Memory**, each as a percentage of what your [server size](/django-cloud-docs/how-it-works/size-and-scaling.md) allows. 100% means the server is fully used.

* **Ranges:** 1 hour, 6 hours, 24 hours, 7 days or 30 days.
* **Underneath each chart:** the latest value, and the average, peak and low for the range you chose.
* **Hover** over a chart to read it. A guide line, a dot on the line and a callout show the **time** (in your own timezone) and the **value**, so you can see exactly when the load was high. On a touch screen, touch and drag. With a keyboard, focus a chart and use the left and right arrow keys.
* **Averages on long ranges.** A chart draws at most 160 points. When a range has more samples than that, each point is the **average** of several, and the callout says so. The **Peak** under the chart always comes from the real samples, so it can be higher than any point you see.

Samples are taken **every 5 minutes** while your app is running and kept for **30 days**. A new deployment shows "No samples in this time range yet" until the first one arrives.

### In the deployments list

Each row of the **Deployments** list has two small graphs, CPU and Memory, for the last 24 hours. They have the same hover callout. The list refreshes every 10 seconds, and pauses while your pointer is on a graph so the callout doesn't disappear while you read it.

### Metrics from the terminal

```bash
djangocloud metrics              # the last hour
djangocloud metrics --since 6h
djangocloud metrics --json       # the samples, for scripts
```

It draws CPU and memory as small charts with the latest value, the peak and the average for the range. The samples are the same ones the Metrics tab uses: every 5 minutes, kept for 30 days, so `--since` can reach back at most 30 days.

### Status from the terminal

```bash
djangocloud status          # is it live and answering, its URL, size and latest releases
djangocloud status --json   # the same as JSON, for scripts
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://django-cloud.gitbook.io/django-cloud-docs/how-it-works/logs-and-metrics.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
