# aspire export command

## Name

`aspire export` - Export telemetry and resource data to a zip file.

## Synopsis

```bash title="Aspire CLI"
aspire export [<resource>] [options]
```

## Description

The `aspire export` command packages telemetry and resource data from a running AppHost into a zip file. Use it when you need to collect diagnostics for troubleshooting, share runtime state with a teammate, or preserve data from a running app for later analysis. Hidden resources are excluded from the export by default; use the `--include-hidden` option to include their data.

When a resource name is provided, the export is limited to data for that resource.

When executed without the `--apphost` option, the command:

1. Scans for all running AppHost processes.
2. If multiple AppHosts are running within the current directory scope, prompts you to select which one to target.
3. If only one AppHost is running in scope, connects to it directly.
4. If no in-scope AppHosts are found but out-of-scope AppHosts exist, displays all running AppHosts for selection.

## Arguments

- **`<resource>`**

  Export data only for the specified resource.

## Options

The following options are available:

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

- **`-o, --output <output>`**

  The output file path for the export zip file.

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

- <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" />

## Zip file contents

The exported zip archive (default name `aspire-export-<timestamp>.zip`) can contain up to four directories, depending on available data:

- **`resources/`** — One JSON file per resource containing resource details such as name, type, state, endpoints, and environment variables.
- **`consolelogs/`** — One plain-text `*.txt` file per resource with raw console output lines.
- **`structuredlogs/`** — One JSON file per resource with structured log entries serialized in [OTLP format](https://opentelemetry.io/docs/specs/otlp/).
- **`traces/`** — One JSON file per resource with distributed traces and spans serialized in [OTLP format](https://opentelemetry.io/docs/specs/otlp/).

When a resource name is provided, only data for that resource is included in the archive. When no resource is specified, data for all visible resources is exported.

:::tip
When analyzing an export, start with the `resources/` directory for an overview of resource state, then drill into `consolelogs/`, `structuredlogs/`, and `traces/` for detailed diagnostics.
:::

## Examples

- Export diagnostics for the current AppHost:

  ```bash title="Aspire CLI"
  aspire export
  ```

- Export data for a specific resource:

  ```bash title="Aspire CLI"
  aspire export webfrontend
  ```

- Write the export to a specific file:

  ```bash title="Aspire CLI"
  aspire export --output '.\\artifacts\\aspire-export.zip'
  ```

- Export data from a specific AppHost project:

  ```bash title="Aspire CLI"
  aspire export --apphost './src/MyApp.AppHost/MyApp.AppHost.csproj'
  ```

- Export diagnostics including hidden resources:

  ```bash title="Aspire CLI"
  aspire export --include-hidden
  ```

## See also

- [aspire describe](../aspire-describe/)
- [aspire logs](../aspire-logs/)
- [aspire otel](../aspire-otel/)