diff --git a/src/frontend/src/content/docs/reference/cli/commands/aspire-logs.mdx b/src/frontend/src/content/docs/reference/cli/commands/aspire-logs.mdx index b52c48714..6edd0c67a 100644 --- a/src/frontend/src/content/docs/reference/cli/commands/aspire-logs.mdx +++ b/src/frontend/src/content/docs/reference/cli/commands/aspire-logs.mdx @@ -18,7 +18,7 @@ aspire logs [] [options] ## Description -The `aspire logs` command displays console logs from resources in a running AppHost. You can view logs for all resources, filter to a specific resource, follow new log entries in real time, and choose table or JSON output for automation. Hidden resources are excluded by default; use the `--include-hidden` option to show their logs. +The `aspire logs` command displays console logs from resources in a running AppHost. You can view logs for all resources, filter to a specific resource, follow new log entries in real time, search log content with full-text filtering, and choose table or JSON output for automation. Hidden resources are excluded by default; use the `--include-hidden` option to show their logs. When executed without the `--apphost` option, the command: @@ -55,6 +55,10 @@ The following options are available: Number of lines to show from the end of the logs. +- **`-s, --search `** + + Full-text search to filter log content. Only log lines whose message or resource name contains the specified text are shown. Multiple words are treated as separate fragments that must all match. Use quoted phrases to match exact multi-word text (for example, `--search '"connection timeout"'`). + - **`-t, --timestamps`** Show timestamps for each log line. @@ -111,6 +115,30 @@ The following options are available: aspire logs --include-hidden ``` +- Filter logs by search text: + + ```bash title="Aspire CLI" + aspire logs --search "error" + ``` + +- Search with multiple words (all must match): + + ```bash title="Aspire CLI" + aspire logs --search "connection failed" + ``` + +- Search for an exact phrase using quotes: + + ```bash title="Aspire CLI" + aspire logs --search '"connection timeout"' + ``` + +- Search logs for a specific resource and show only the last 75 matching lines: + + ```bash title="Aspire CLI" + aspire logs producer --search needle --tail 75 + ``` + ## See also - [aspire describe](../aspire-describe/)