---
title: luna logs
description: Read an environment's log lines, filter them by luna, call, level or text, and follow new ones as they come.
related:
  - /observe/read-logs
  - /cli/traces
  - /cli/dev
---

`luna logs` prints an environment's log lines: what your code wrote, and Luna's own lines about calls, wakes and sleeps.

```bash
luna logs --follow
```

## Reference

```bash
luna logs [OPTIONS] [TYPE]
```

| Option | Type | Default | Does |
| --- | --- | --- | --- |
| `[TYPE]` | text | Every type | Prints only the lines of this luna type. |
| `--key <KEY>` | text | None | Prints only the lines of this luna: its key, or the value of one of its key's fields. |
| `--call <CALL>` | text | None | Prints only the lines of this call. |
| `--trace <TRACE>` | text | None | Prints only the lines of this trace. |
| `--level <LEVEL>` | text | Every level | Prints this level and above: `debug`, `info`, `warn` or `error`. |
| `--grep <TEXT>` | text | None | Prints only lines that contain this text. |
| `--source <SOURCE>` | text | Both | `luna` prints only Luna's own lines. `code` prints only what your code wrote. |
| `--event <EVENTS>` | text | Every event | Prints only Luna's lines of these events, separated by commas. |
| `--outcome <OUTCOME>` | text | Every outcome | Prints only calls that ended this way: `ok`, `error` or `timeout`. |
| `--since <SINCE>` | moment | `1h` | Starts at this [moment](/cli#moments). |
| `--until <UNTIL>` | moment | Now | Ends at this moment. Not with `--follow`. |
| `--limit <LIMIT>` | number | `200` | The most lines of history to print. |
| `-f`, `--follow` | flag | Off | Keeps printing new lines until you stop it. |
| `--json` | flag | Off | Prints each line as Luna sent it, one JSON object a line. |
| `--dir <DIR>` | path | `.` | The app's folder. Its env file names the project and environment. |
| `--env <ENV>` | text | `LUNA_ENV`, then `production` | The environment. |
| `--project <PROJECT>` | text | `LUNA_PROJECT` | The project, by name or as `organisation/project`. |
| `--tenant <TENANT>` | text | The environment's own | A tenant added to the environment, by name. |
| `--token <TOKEN>` | text | `LUNA_TOKEN`, then your login | An API token or account key to act with. |

The events `--event` takes are `call`, `wake`, `sleep`, `move`, `version`, `timeout`, `refused`, `deadLetter`, `crash`, `sandbox`, `retry`, `destroy` and `restore`.

## Good to know

- With `--follow`, the CLI first prints the history that matches, then asks for new lines every half second.
- When Luna stops answering, `--follow` keeps trying and says so. It gives up after five minutes without an answer. A refusal, such as a revoked token, ends it at once.
- [`luna dev`](/cli/dev) follows the environment's lines as it deploys.

## Examples

### Follow one luna's lines

```bash
luna logs List --key groceries --follow
```

### Read the errors of the last day

```bash
luna logs --level error --since 24h
```

### Read the calls that timed out

```bash
luna logs --source luna --event call --outcome timeout
```

### Read every line of one trace

```bash
luna logs --trace <TRACE_ID>
```
