# Tail and search your logs from the terminal

The web app is the best place to dig into a problem. When you're already in a terminal, deploying or SSHed into a box, it's quicker to stay there. The `tailcove` command line tool follows a source as lines arrive, searches it with the same [query language](https://tailcove.dev/docs/query-language) as the search bar, and sends any program's output to a source. This guide sets it up and walks through the commands you'll use most. Every flag is in the [CLI docs](https://tailcove.dev/docs/cli).

## 1. Install it

`tailcove` ships with every release of the [Tailcove agent](https://tailcove.dev/docs/sending-logs/agent) as one static binary. Pick your system:

```bash@macOS
# Apple silicon (M1 and later). On an Intel Mac use tailcove_darwin_amd64.tar.gz.
curl -fsSL https://github.com/tailcove/agent/releases/latest/download/tailcove_darwin_arm64.tar.gz | tar -xz tailcove
sudo install -m 0755 tailcove /usr/local/bin/tailcove
tailcove version
```

```bash@Linux
# x86_64. On an ARM server use tailcove_linux_arm64.tar.gz.
curl -fsSL https://github.com/tailcove/agent/releases/latest/download/tailcove_linux_amd64.tar.gz | tar -xz tailcove
sudo install -m 0755 tailcove /usr/local/bin/tailcove
tailcove version
```

```powershell@Windows
# There's no Windows build yet. Install WSL once (it needs a restart), then
# run the Linux commands inside the Ubuntu terminal it adds.
wsl --install
```

`uname -m` tells you which Mac you have: `arm64` is Apple silicon, `x86_64` is Intel. With Go 1.24 or newer, `go install github.com/tailcove/agent/cmd/tailcove@latest` works too.

## 2. Sign in

```bash
tailcove login
```

It prints a code like `BCDF-GHJK` and opens the activation page in your browser. Check the code matches, look at the device name and address the page shows, and press **Approve**. The terminal saves its token in `~/.config/tailcove/config.json`, readable by you only.

On a server you reached over SSH, no browser opens: open the link on your laptop and type the code there. Only approve a code you started yourself.

```bash
tailcove whoami
tailcove sources
```

![tailcove whoami naming the team Shop and user Ana Silva, then tailcove sources listing shop-production](https://tailcove.dev/images/guides/tail-logs-from-the-terminal/whoami-sources.mp4 "whoami and sources on a demo team with one source, shop-production. Use the id or the name in every command.")

`whoami` names the team and user the token acts as. `sources` lists the team's sources with their ids, names and platforms. You can name a source by either in every command below, and leave it out when the team has only one.

## 3. Follow a source live

```bash
tailcove tail checkout-api
```

![tailcove tail shop-production printing recent lines, then a checkout, a payment error and a retry warning as they arrive](https://tailcove.dev/images/guides/tail-logs-from-the-terminal/tail.mp4 "Following the demo source shop-production: the last lines first, then each new one as it's stored, coloured by level.")

You get the last 10 lines, then each new one as it arrives, coloured by level, until you press Ctrl+C. Add a query to narrow it down:

```bash
tailcove tail checkout-api 'level:error OR status>=500' -host:canary
```

`--json` prints one JSON object per line, which makes `jq` the filter for anything the query language doesn't cover:

```bash
tailcove tail checkout-api --json | jq -r 'select(.context.duration_ms > 2000) | "\(.ts) \(.message)"'
```

The tool asks for new lines every 2 seconds and backs off when the API asks it to, so a line shows up a couple of seconds after Tailcove stores it.

## 4. Search what already happened

```bash
tailcove search checkout-api '"connection refused"' --since 6h --limit 200
```

![tailcove search shop-production level:error --since 1h listing three errors, newest first](https://tailcove.dev/images/guides/tail-logs-from-the-terminal/search.mp4 "A search for level:error over the last hour on the demo source: newest first, with the host each came from.")

Results come newest first. `--since` takes `15m`, `6h` or `2d`; `--from` and `--to` take a time such as `2026-11-30T09:00` for a window in the past. With `--json`, a quick count of which hosts logged the errors:

```bash
tailcove search checkout-api level:error --since 1h --limit 1000 --json | jq -r .host | sort | uniq -c | sort -rn
```

## 5. Send a script's output to Tailcove

`tailcove pipe` passes standard input straight through and sends each line to a source. It uses the source's ingest token, the one your apps send with, not your login:

```bash
export TAILCOVE_SOURCE_TOKEN=your-source-token
./backup.sh 2>&1 | tailcove pipe
```

![cat backup.sh shows a script that only echoes three lines; ./backup.sh 2>&1 | tailcove pipe prints those same lines; a search then shows them stored with INFO and ERROR levels](https://tailcove.dev/images/guides/tail-logs-from-the-terminal/pipe.mp4 "The script only prints lines. tailcove pipe shows them as they are and sends each one to the source, where a search finds them with the level read from the text.")

The level of each line is read from its text (`ERROR`, `warn`, `[info]`), or set for every line with `--level`. Secrets are masked before anything leaves the machine. If Tailcove can't be reached, the output still passes through and the pipe still exits `0`, so it never breaks the script.

That also means the pipeline's exit status is the pipe's. In cron, add `set -o pipefail` so a failing script still counts as a failure:

```crontab
SHELL=/bin/bash
TAILCOVE_SOURCE_TOKEN=your-source-token
15 3 * * * set -o pipefail; /usr/local/bin/backup.sh 2>&1 | tailcove pipe >> /var/log/backup.log
```

Then an [alert](https://tailcove.dev/docs/alerts) on the source for `level:error` tells you when last night's backup failed.

## 6. Set up a new project

In a project's folder, `tailcove init` works out what it's built with, picks a source or makes one, installs the matching client package once you say yes, and sends a test line:

```bash
cd my-app
tailcove init
```

For an app that runs on a server it adds `TAILCOVE_TOKEN` to `.env`, without ever replacing one that's there. Leave `tailcove tail` running in another terminal to watch the test line arrive.

## FAQ

**Does tailing use my log quota?**

No. `tail` and `search` only read. Only `pipe` and `init`'s test line send lines.

**How many tails can I run at once?**

A token gets 60 API requests a minute and a tail asks every 2 seconds, so one token comfortably runs a couple. Past that they slow down rather than fail.

**How do I sign a machine out?**

`tailcove logout` deletes the saved token on that machine. To stop the token working, revoke it under **Settings → API tokens**, where it's named "Tailcove CLI on" and the machine's name.

**Does it run on Windows?**

Not yet. The releases have Linux and macOS builds, amd64 and arm64.
