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

# logs

> Stream runtime logs for an Alpic environment

Stream runtime logs for an environment. Fetches recent log entries and optionally follows new ones as they arrive.

## Usage

```bash theme={null}
alpic logs --environment-id <environmentId>
```

Fetches log entries for the specified environment.

## Extended Usage

Show logs from the last hour:

```bash theme={null}
alpic logs --environment-id <environmentId> --since 1h
```

Follow logs continuously as new entries arrive:

```bash theme={null}
alpic logs --environment-id <environmentId> --follow
```

<Note>
  When `--follow` is used without `--since`, the CLI defaults to showing logs from the last 10 minutes before polling
  for new entries.
</Note>

Show logs up to a specific point in time:

```bash theme={null}
alpic logs --environment-id <environmentId> --since 1h --until 30m
```

<Note>`--until` cannot be used together with `--follow`.</Note>

Filter by one or more log levels:

```bash theme={null}
alpic logs --environment-id <environmentId> --level ERROR --level WARNING
```

Search log entries by keyword or filter expression:

```bash theme={null}
alpic logs --environment-id <environmentId> --search 'timeout' --limit 50
```

Disable colorized output:

```bash theme={null}
alpic logs --environment-id <environmentId> --no-color
```

## Options

| Flag               | Short | Description                                                                                           | Default |
| ------------------ | ----- | ----------------------------------------------------------------------------------------------------- | ------- |
| `--environment-id` |       | The ID of the environment                                                                             |         |
| `--since`          |       | Show logs after this time (e.g. `1h`, `30m`, `2024-01-01T00:00:00Z`)                                  |         |
| `--until`          |       | Show logs before this time (e.g. `1h`, `30m`, `2024-01-01T00:00:00Z`). Cannot be used with `--follow` |         |
| `--limit`          | `-n`  | Maximum number of log entries to fetch (1–1000). Cannot be used with `--follow`                       |         |
| `--follow`         | `-f`  | Poll for new logs continuously                                                                        | `false` |
| `--level`          |       | Filter by log level (`INFO`, `ERROR`, `WARNING`, `DEBUG`). Repeatable.                                |         |
| `--search`         |       | Filter logs by text or regex pattern                                                                  |         |
| `--no-color`       |       | Disable colorized output and show log levels as text                                                  | `false` |
