# aspire otel logs command

## Name

`aspire otel logs` - View structured logs from the Dashboard telemetry API.

## Synopsis

```bash title="Aspire CLI"
aspire otel logs [resource] [options]
```

<AsciinemaPlayer
  src="/casts/aspire-otel-logs.cast"
  poster="npt:0:01"
  rows={29}
  loop={false}
  speed={.5}
/>

## Description

The `aspire otel logs` command retrieves and displays structured logs collected by the Aspire Dashboard. You can filter logs by resource name, trace ID, or severity level. Use `--follow` to stream logs in real-time as they arrive.

## Arguments

- **`[resource]`**

  Filter by resource name. When specified, only logs from the matching resource are shown. Supports both exact instance names and base resource names (which match all replicas).

## Options

The following options are available:

- **`--apphost <apphost>`**

  The path to the Aspire AppHost project file.

- **`-f, --follow`**

  Stream telemetry in real-time as it arrives.

- **`--format <Table|Json>`**

  Output format (Table or Json).

- **`-n, --limit <limit>`**

  Maximum number of items to return.

- **`--trace-id <trace-id>`**

  Filter by trace ID.

- **`--severity <severity>`**

  Filter logs by minimum severity (Trace, Debug, Information, Warning, Error, Critical).

- <Include relativePath="reference/cli/includes/option-help.md" />

- <Include relativePath="reference/cli/includes/option-log-level.md" />

- <Include relativePath="reference/cli/includes/option-non-interactive.md" />

- <Include relativePath="reference/cli/includes/option-nologo.md" />

- <Include relativePath="reference/cli/includes/option-banner.md" />

- <Include relativePath="reference/cli/includes/option-wait.md" />

## Examples

- View all structured logs:

  ```bash title="Aspire CLI"
  aspire otel logs
  ```

- View logs for a specific resource:

  ```bash title="Aspire CLI"
  aspire otel logs apiservice
  ```

- Stream logs in real-time:

  ```bash title="Aspire CLI"
  aspire otel logs --follow
  ```

- View only error-level logs in JSON format:

  ```bash title="Aspire CLI"
  aspire otel logs --severity Error --format Json
  ```

- View the last 50 logs for a resource:

  ```bash title="Aspire CLI"
  aspire otel logs apiservice --limit 50
  ```

## See also

- [aspire otel command](../aspire-otel/)
- [aspire otel spans command](../aspire-otel-spans/)
- [aspire otel traces command](../aspire-otel-traces/)