Step 6

View and filter logs

~5 minutes
Marks this step as complete and saves your progress

The azd app logs command provides powerful log viewing and filtering capabilities for debugging and monitoring your services.

View All Logs

Stream logs from all local services:

bash
azd app logs
Console view with log streaming and service filters

View Logs for a Specific Service

Focus on logs from one service:

bash
azd app logs --service api

Filter and Search Logs

Filter by Log Level

Show only errors:

bash
azd app logs --level error

Time Range

Show logs from the last hour:

bash
azd app logs --since 1h
Log filtering and search capabilities in the Console view

Log Output Options

Follow Mode (Default)

Continuously stream new logs:

bash
azd app logs --follow

Show Timestamps

bash
azd app logs --timestamps

JSON Output

For programmatic parsing:

bash
azd app logs --format json

Try It Yourself

Run `azd app logs --service api` to view logs from just the API service. Try `--level error` to filter for errors.

Expected: You should see a filtered stream of logs from the specified service.

Combining Filters

You can combine multiple filters:

bash
azd app logs --service api --level error --since 30m

Export Logs

Save logs to a file for later analysis:

bash
azd app logs --file logs.txt

Dashboard Logs

The dashboard also provides a log viewer with filtering, search, and syntax highlighting. Access it via the Console tab.

Local vs Azure Logs

The dashboard supports viewing both local and Azure cloud logs in one unified interface. Use the mode toggle in the console toolbar to switch between:

  • Local - Logs from locally running services
  • Azure - Live logs from your deployed Azure services via Log Analytics
Azure cloud logs view with service filtering and time range selection

Azure Cloud Log Streaming

When you provision Azure services with azd provision or azd up, the dashboard can stream logs from Container Apps, App Service, and Functions directly into your local view with 1-5 minute latency. This lets you monitor both local and deployed services without switching tools.

Configuration: Add Azure Log Analytics settings in your azure.yaml:

yaml
logs:
  analytics:
    pollingInterval: 30s    # Refresh interval
    defaultTimespan: PT15M  # Time range for queries

services:
  web:
    host: appservice
    path: ./src/web
    logs:
      analytics:
        table: AppServiceConsoleLogs

Note: Azure Log Analytics has a typical ingestion delay of 1-5 minutes. Logs are not real-time but refresh automatically based on your polling interval.

Learn more in the Azure Cloud Log Streaming reference.