---
title: Logs
description: Search a project's logs, or follow them as they arrive.
order: 3
---

```sh
ops logs                                   # the newest 200 lines of the chosen project
ops logs --service web --level error       # one service, errors only
ops logs --grep "payment" --since 2h       # lines holding a word, from two hours back
ops logs -f                                # follow, until Ctrl+C
```

Lines print oldest first: time, level, service and message.

| option | effect |
| --- | --- |
| `--service <name>` | one service |
| `--level <level>` | one level, such as `error` or `warn` |
| `--grep <text>` | lines whose message holds the text |
| `--since <time>` | from `30s`, `5m`, `2h` or `7d` ago, or from an RFC 3339 time |
| `--env <name>` | another environment than production |
| `--limit <n>` | at most this many lines, 1 to 1000. The default is 200 |
| `-f` | keep following |
| `--interval <secs>` | how often a follow asks for new lines. The default is 2 seconds |

## Following

`-f` starts with the last five minutes (or `--since`) and then asks for new lines every
interval, and less often after several polls in a row bring nothing. In a burst of more than ten thousand lines
between two polls it prints the newest and says that the oldest were not printed. Ctrl+C
ends the follow and exits 0.

When there is nothing to show, `None` goes to stderr, so a pipe into `grep` receives only
log lines.
