İçeriğe geç
Docs Try Aspire
Docs Try

aspire otel logs command

Bu içerik henüz dilinizde mevcut değil.

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

Aspire CLI
aspire otel logs [resource] [options]

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

  • [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).

The following options are available:

  • --apphost <apphost>

    The path to the Aspire AppHost project file. Mutually exclusive with --dashboard-url.

  • --dashboard-url <url>

    The URL of a standalone Aspire Dashboard to query instead of discovering one from an AppHost. Accepts a base URL (for example, http://localhost:18888) or a full login URL including a browser token (for example, http://localhost:18888/login?t=<token>). When a login URL is provided, the token is automatically exchanged for an API key. Mutually exclusive with --apphost.

  • --api-key <key>

    The API key used to authenticate with the dashboard’s Telemetry API. Only required when --dashboard-url is specified and the dashboard is configured with ApiKey authentication and no login URL is provided.

  • -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).

  • --search <search>

    Full-text search across log text fields, such as log messages, attribute values, scope, and IDs. Supports plain free-text fragments and structured field:value qualifiers. For more information, see Search and filter.

    SyntaxMeaning
    wordFree-text fragment — matches any searchable field
    "quoted phrase"Single fragment containing spaces
    field:valueField qualifier — value must match the named field
    -field:valueNegated qualifier — excludes matches
    @attr:valueAttribute qualifier — matches custom log attributes

    Supported fields for structured logs: severity, resource, scope, message, trace-id, span-id, event.

  • -?, -h, --help

    Prints help and usage documentation for the available commands and options.

  • -l, --log-level <Critical|Debug|Error|Information|None|Trace|Warning>

    Set the minimum log level for console output. Use this option to increase diagnostics while troubleshooting or reduce output in scripted runs.

  • --non-interactive

    Run the command in non-interactive mode, disabling all interactive prompts and spinners.

  • --nologo

    Suppress the startup banner and telemetry notice.

  • --banner

    Display the animated Aspire CLI welcome banner.

  • --wait-for-debugger

    Wait for a debugger to attach before running a command.

  • View all structured logs:

    Aspire CLI
    aspire otel logs
  • View logs for a specific resource:

    Aspire CLI
    aspire otel logs apiservice
  • Stream logs in real-time:

    Aspire CLI
    aspire otel logs --follow
  • View only error-level logs in JSON format:

    Aspire CLI
    aspire otel logs --severity Error --format Json
  • View the last 50 logs for a resource:

    Aspire CLI
    aspire otel logs apiservice --limit 50
  • Search logs by message text:

    Aspire CLI
    aspire otel logs --search "connection refused"
  • Search logs by scope and severity:

    Aspire CLI
    aspire otel logs --search "scope:Microsoft.EntityFrameworkCore severity:Warning"
  • View logs from a standalone dashboard using the login URL (token is automatically exchanged for an API key):

    Aspire CLI
    aspire otel logs --dashboard-url "http://localhost:18888/login?t=<token>"
  • View logs from a secured standalone Aspire Dashboard:

    Aspire CLI
    aspire otel logs --dashboard-url "http://localhost:18888" --api-key "<your-api-key>"