> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# astro deployment logs

> Show Airflow component logs for a Deployment.

<Info>The behavior and format of this command differs depending on what Astronomer product you're using. Use the following tabs to change product contexts.</Info>

<Tabs>
  <Tab title="Astro">
    Show [Airflow component logs](/docs/astro/view-logs#view-airflow-component-logs-in-the-astro-ui) over the last 24 hours for a given Deployment on Astro. These are the same logs that appear in the **Logs** tab of the Astro UI.

    ## Usage

    ```sh wrap theme={null}
    astro deployment logs
    ```

    <Info>When you filter logs using the command flags `--error`, `--warn`, `--info`, and `--key-word`, you can specify only one filter flag per command.</Info>

    ## Options

    | Option | Description | Possible Values |
    | - | - | - |
    | `<deployment-id>` | The ID of the Deployment to show logs for | Any valid Deployment ID |
    | `-n`, `--deployment-name` | The name of the Deployment to show logs for. Use as an alternative to `<deployment-id>`. | Any valid Deployment name |
    | `-e`,`--error` | Show only logs with a log level of `ERROR` | None |
    | `-i`,`--info` | Show only logs with a log level of `INFO` | None |
    | `--keyword` | Search the Deployment logs for a specific keyword or phrase. | None |
    | `-c`,`--log-count` | The number of log lines to show. The default is `500`. The Astro CLI paginates the underlying API to return the full requested number of lines. | Any integer. If you request a number of log lines that exceeds the total number of logs, then it shows all existing logs. |
    | `--component` | Show logs from one or more components by name, passed as a repeatable flag or a comma-separated list. Use as an alternative to flags such as `--scheduler` or `--triggerer`. | Any valid component name, for example `scheduler` or `dag-processor` |
    | `--dag-processor` | Show logs from the Dag processor | None |
    | `--scheduler` | Show logs from the scheduler | None |
    | `--triggerer` | Show logs from the triggerer | None |
    | `-w`,`--warn` | Show only logs with a log level of `WARNING` | None |
    | `--webserver` | Show logs from the webserver | None |
    | `--workers` | Show logs from the workers | None |
    | `--workspace-id` | Specify a Workspace to show logs for a Deployment outside of your current Workspace | Any valid Workspace ID |

    ## Examples

    ```sh wrap theme={null}
    $ astro deployment logs
    # CLI prompts you for a Deployment to view logs for

    $ astro deployment logs cl03oiq7d80402nwn7fsl3dmv
    # View logs for a specific Deployment

    $ astro deployment logs --deployment-name="My Deployment" --error --log-count=25
    # Show only the last 25 error-level logs

    $ astro deployment logs cl03oiq7d80402nwn7fsl3dmv --dag-processor
    # Show Dag processor logs for a specific Deployment

    $ astro deployment logs cl03oiq7d80402nwn7fsl3dmv --component scheduler,dag-processor
    # Show logs from multiple components in a single command
    ```
  </Tab>

  <Tab title="APC">
    Show Airflow component logs over the last 24 hours for a given Deployment. These logs are the same logs that appear in the **Logs** tab of the UI.

    ## Usage

    Run one of the following commands depending on which logs you want to stream:

    ```sh wrap theme={null}
    astro deployment logs <deployment-id> scheduler
    astro deployment logs <deployment-id> webserver
    astro deployment logs <deployment-id> workers
    astro deployment logs <deployment-id> triggerer
    ```

    ## Options

    | Option | Description | Possible values |
    | - | - | - |
    | `<deployment-id>` (\_Required) | The ID of the Deployment for which you want to view logs | Any valid Deployment ID |
    | `<airflow-component>` (\_Required) | The Airflow component for which you want to view logs | `scheduler`, `webserver`, `workers`, or `triggerer` |
    | `--follow` | Subscribes to watch more logs | None |
    | `--search` | Searches for the specified string within the logs you're following | Any string |
    | `--since` | Limits past logs to those generated in the lookback window | Lookback time in `h` or `m` (for example, `5m` or `2h`) |

    ## Examples

    ```sh wrap theme={null}
    # Return logs for last five minutes of webserver logs.
    $ astro deployment logs webserver example-deployment-uuid

    # Return logs from airflow workers for the last 5 minutes with a given search term, and subscribe to view more as they are generated.
    $ astro deployment logs workers example-deployment-uuid --follow --search "some search terms"

    # Return logs from airflow webserver for last 25 minutes.
    $ astro deployment logs webserver example-deployment-uuid --since 25m
    ```
  </Tab>
</Tabs>

## Related commands

* [`astro dev logs`](/docs/cli/v1.46/astro-dev-logs)
* [`astro dev run`](/docs/cli/v1.46/astro-dev-run)
* [`astro dev ps`](/docs/cli/v1.46/astro-dev-ps)
